@remix-run/test 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +140 -35
- package/dist/app/client/entry.d.ts +2 -0
- package/dist/app/client/entry.d.ts.map +1 -0
- package/dist/app/client/entry.js +324 -0
- package/dist/app/client/iframe.d.ts +2 -0
- package/dist/app/client/iframe.d.ts.map +1 -0
- package/dist/app/client/iframe.js +22 -0
- package/dist/app/server.d.ts +6 -0
- package/dist/app/server.d.ts.map +1 -0
- package/dist/app/server.js +303 -0
- package/dist/cli-entry.d.ts +3 -0
- package/dist/cli-entry.d.ts.map +1 -0
- package/dist/cli-entry.js +14 -0
- package/dist/cli.d.ts +7 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +273 -139
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/colors.d.ts +2 -0
- package/dist/lib/colors.d.ts.map +1 -0
- package/dist/lib/colors.js +2 -0
- package/dist/lib/config.d.ts +32 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +125 -22
- package/dist/lib/context.d.ts +37 -13
- package/dist/lib/context.d.ts.map +1 -1
- package/dist/lib/context.js +19 -3
- package/dist/lib/coverage-loader.d.ts +16 -0
- package/dist/lib/coverage-loader.d.ts.map +1 -0
- package/dist/lib/coverage-loader.js +20 -0
- package/dist/lib/coverage.d.ts +28 -0
- package/dist/lib/coverage.d.ts.map +1 -0
- package/dist/lib/coverage.js +212 -0
- package/dist/lib/executor.d.ts +3 -26
- package/dist/lib/executor.d.ts.map +1 -1
- package/dist/lib/executor.js +11 -6
- package/dist/lib/fake-timers.d.ts +6 -0
- package/dist/lib/fake-timers.d.ts.map +1 -0
- package/dist/lib/fake-timers.js +45 -0
- package/dist/lib/import-module.d.ts +2 -0
- package/dist/lib/import-module.d.ts.map +1 -0
- package/dist/lib/import-module.js +29 -0
- package/dist/lib/normalize.d.ts +2 -0
- package/dist/lib/normalize.d.ts.map +1 -0
- package/dist/lib/{utils.js → normalize.js} +0 -9
- package/dist/lib/playwright.d.ts +1 -1
- package/dist/lib/playwright.d.ts.map +1 -1
- package/dist/lib/playwright.js +5 -8
- package/dist/lib/reporters/dot.d.ts +1 -2
- package/dist/lib/reporters/dot.d.ts.map +1 -1
- package/dist/lib/reporters/dot.js +2 -1
- package/dist/lib/reporters/files.d.ts +1 -2
- package/dist/lib/reporters/files.d.ts.map +1 -1
- package/dist/lib/reporters/files.js +2 -1
- package/dist/lib/reporters/index.d.ts +4 -5
- package/dist/lib/reporters/index.d.ts.map +1 -1
- package/dist/lib/reporters/index.js +3 -3
- package/dist/lib/reporters/results.d.ts +30 -0
- package/dist/lib/reporters/results.d.ts.map +1 -0
- package/dist/lib/reporters/results.js +1 -0
- package/dist/lib/reporters/spec.d.ts +1 -2
- package/dist/lib/reporters/spec.d.ts.map +1 -1
- package/dist/lib/reporters/spec.js +2 -1
- package/dist/lib/reporters/tap.d.ts +1 -2
- package/dist/lib/reporters/tap.d.ts.map +1 -1
- package/dist/lib/reporters/tap.js +1 -1
- package/dist/lib/runner-browser.d.ts +21 -0
- package/dist/lib/runner-browser.d.ts.map +1 -0
- package/dist/lib/runner-browser.js +117 -0
- package/dist/lib/runner.d.ts +7 -2
- package/dist/lib/runner.d.ts.map +1 -1
- package/dist/lib/runner.js +33 -4
- package/dist/lib/runtime.d.ts +2 -0
- package/dist/lib/runtime.d.ts.map +1 -0
- package/dist/lib/runtime.js +2 -0
- package/dist/lib/ts-transform.d.ts +4 -0
- package/dist/lib/ts-transform.d.ts.map +1 -0
- package/dist/lib/ts-transform.js +29 -0
- package/dist/lib/worker-e2e.js +5 -4
- package/dist/lib/worker.js +31 -3
- package/dist/test/coverage/fixture.d.ts +5 -0
- package/dist/test/coverage/fixture.d.ts.map +1 -0
- package/dist/test/coverage/fixture.js +32 -0
- package/dist/test/coverage/test-browser.d.ts +2 -0
- package/dist/test/coverage/test-browser.d.ts.map +1 -0
- package/dist/test/coverage/test-browser.js +24 -0
- package/dist/test/coverage/test-e2e.d.ts +2 -0
- package/dist/test/coverage/test-e2e.d.ts.map +1 -0
- package/dist/test/coverage/test-e2e.js +60 -0
- package/dist/test/coverage/test-unit.d.ts +2 -0
- package/dist/test/coverage/test-unit.d.ts.map +1 -0
- package/dist/test/coverage/test-unit.js +27 -0
- package/dist/test/framework.test.browser.d.ts +2 -0
- package/dist/test/framework.test.browser.d.ts.map +1 -0
- package/dist/test/framework.test.browser.js +107 -0
- package/dist/test/framework.test.e2e.d.ts.map +1 -0
- package/dist/test/framework.test.e2e.js +34 -0
- package/package.json +30 -9
- package/src/app/client/entry.ts +353 -0
- package/src/app/client/iframe.ts +18 -0
- package/src/app/server.ts +336 -0
- package/src/cli-entry.ts +15 -0
- package/src/cli.ts +322 -148
- package/src/index.ts +1 -0
- package/src/lib/colors.ts +3 -0
- package/src/lib/config.ts +169 -23
- package/src/lib/context.ts +59 -17
- package/src/lib/coverage-loader.ts +31 -0
- package/src/lib/coverage.ts +320 -0
- package/src/lib/executor.ts +18 -35
- package/src/lib/fake-timers.ts +64 -0
- package/src/lib/import-module.ts +29 -0
- package/src/lib/{utils.ts → normalize.ts} +0 -18
- package/src/lib/playwright.ts +5 -7
- package/src/lib/reporters/dot.ts +3 -2
- package/src/lib/reporters/files.ts +3 -2
- package/src/lib/reporters/index.ts +4 -5
- package/src/lib/reporters/results.ts +29 -0
- package/src/lib/reporters/spec.ts +3 -2
- package/src/lib/reporters/tap.ts +2 -2
- package/src/lib/runner-browser.ts +165 -0
- package/src/lib/runner.ts +62 -10
- package/src/lib/runtime.ts +2 -0
- package/src/lib/ts-transform.ts +36 -0
- package/src/lib/worker-e2e.ts +7 -5
- package/src/lib/worker.ts +24 -4
- package/src/test/coverage/fixture.ts +34 -0
- package/src/test/coverage/test-browser.ts +29 -0
- package/src/test/coverage/test-e2e.ts +70 -0
- package/src/test/coverage/test-unit.ts +32 -0
- package/tsconfig.json +3 -1
- package/dist/lib/e2e-server.d.ts +0 -11
- package/dist/lib/e2e-server.d.ts.map +0 -1
- package/dist/lib/e2e-server.js +0 -15
- package/dist/lib/framework.test.d.ts +0 -2
- package/dist/lib/framework.test.d.ts.map +0 -1
- package/dist/lib/framework.test.e2e.d.ts.map +0 -1
- package/dist/lib/framework.test.e2e.js +0 -29
- package/dist/lib/framework.test.js +0 -283
- package/dist/lib/utils.d.ts +0 -16
- package/dist/lib/utils.d.ts.map +0 -1
- package/src/lib/e2e-server.ts +0 -28
- /package/dist/{lib → test}/framework.test.e2e.d.ts +0 -0
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@remix-run/component/jsx-runtime";
|
|
2
|
-
import assert from '@remix-run/assert';
|
|
3
|
-
import { renderToString } from '@remix-run/component/server';
|
|
4
|
-
import { createRouter } from '@remix-run/fetch-router';
|
|
5
|
-
import { route } from '@remix-run/fetch-router/routes';
|
|
6
|
-
import { describe, it } from "./framework.js";
|
|
7
|
-
const html = async (n) => new Response(await renderToString(n), {
|
|
8
|
-
headers: { 'Content-Type': 'text/html' },
|
|
9
|
-
});
|
|
10
|
-
describe('e2e tests', () => {
|
|
11
|
-
it('runs playwright against a fetch-router instance', async (t) => {
|
|
12
|
-
function Doc() {
|
|
13
|
-
return ({ children }) => (_jsxs("html", { children: [
|
|
14
|
-
_jsx("head", { children: _jsx("title", { children: "Test" }) }), _jsx("body", { children: children })
|
|
15
|
-
] }));
|
|
16
|
-
}
|
|
17
|
-
let routes = route({ home: '/', about: '/about' });
|
|
18
|
-
let router = createRouter();
|
|
19
|
-
router.get(routes.home, async () => html(_jsxs(Doc, { children: [
|
|
20
|
-
_jsx("h1", { children: "Hello Remix" }), _jsx("a", { href: "/about", children: "About" })
|
|
21
|
-
] })));
|
|
22
|
-
router.get(routes.about, async () => html(_jsx(Doc, { children: _jsx("h1", { children: "About Remix" }) })));
|
|
23
|
-
let page = await t.serve(router.fetch);
|
|
24
|
-
await page.goto('/');
|
|
25
|
-
assert.equal(await page.locator('h1').textContent(), 'Hello Remix');
|
|
26
|
-
await page.click('[href="/about"]');
|
|
27
|
-
assert.equal(await page.locator('h1').textContent(), 'About Remix');
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
import * as assert from '@remix-run/assert';
|
|
2
|
-
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, suite, test, } from "./framework.js";
|
|
3
|
-
// During test execution, currentSuite is null so describe() can be called freely.
|
|
4
|
-
// captureRegistration() splices any newly-registered suites back out of __testSuites
|
|
5
|
-
// so the executor doesn't run them — we just inspect their shape.
|
|
6
|
-
function captureRegistration(fn) {
|
|
7
|
-
let suites = globalThis.__testSuites;
|
|
8
|
-
let before = suites.length;
|
|
9
|
-
fn();
|
|
10
|
-
return suites.splice(before);
|
|
11
|
-
}
|
|
12
|
-
// ── describe ──────────────────────────────────────────────────────────────────
|
|
13
|
-
describe('describe', () => {
|
|
14
|
-
it('has skip, only, and todo sub-functions', () => {
|
|
15
|
-
assert.equal(typeof describe.skip, 'function');
|
|
16
|
-
assert.equal(typeof describe.only, 'function');
|
|
17
|
-
assert.equal(typeof describe.todo, 'function');
|
|
18
|
-
});
|
|
19
|
-
it('registers a suite with the given name', () => {
|
|
20
|
-
let [s] = captureRegistration(() => describe('my suite', () => { }));
|
|
21
|
-
assert.equal(s.name, 'my suite');
|
|
22
|
-
});
|
|
23
|
-
it('calls fn to register tests', () => {
|
|
24
|
-
let called = false;
|
|
25
|
-
captureRegistration(() => describe('suite', () => {
|
|
26
|
-
called = true;
|
|
27
|
-
}));
|
|
28
|
-
assert.equal(called, true);
|
|
29
|
-
});
|
|
30
|
-
it('registers tests added inside fn', () => {
|
|
31
|
-
let [s] = captureRegistration(() => describe('suite', () => {
|
|
32
|
-
it('test one', () => { });
|
|
33
|
-
it('test two', () => { });
|
|
34
|
-
}));
|
|
35
|
-
assert.equal(s.tests.length, 2);
|
|
36
|
-
assert.equal(s.tests[0].name, 'test one');
|
|
37
|
-
assert.equal(s.tests[1].name, 'test two');
|
|
38
|
-
});
|
|
39
|
-
it('flattens nested describes into "Outer > Inner" names', () => {
|
|
40
|
-
let [outer, inner] = captureRegistration(() => {
|
|
41
|
-
describe('outer', () => {
|
|
42
|
-
describe('inner', () => { });
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
assert.equal(outer.name, 'outer');
|
|
46
|
-
assert.equal(inner.name, 'outer > inner');
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
describe('describe.skip', () => {
|
|
50
|
-
it('marks the suite as skipped', () => {
|
|
51
|
-
let [s] = captureRegistration(() => describe.skip('suite', () => { }));
|
|
52
|
-
assert.equal(s.skip, true);
|
|
53
|
-
});
|
|
54
|
-
it('still calls fn to register tests', () => {
|
|
55
|
-
let [s] = captureRegistration(() => describe.skip('suite', () => {
|
|
56
|
-
it('test', () => { });
|
|
57
|
-
}));
|
|
58
|
-
assert.equal(s.tests.length, 1);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
describe('describe.only', () => {
|
|
62
|
-
it('marks the suite as only', () => {
|
|
63
|
-
let [s] = captureRegistration(() => describe.only('suite', () => { }));
|
|
64
|
-
assert.equal(s.only, true);
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
describe('describe.todo', () => {
|
|
68
|
-
it('marks the suite as todo', () => {
|
|
69
|
-
let [s] = captureRegistration(() => describe.todo('suite'));
|
|
70
|
-
assert.equal(s.todo, true);
|
|
71
|
-
});
|
|
72
|
-
it('registers with no tests', () => {
|
|
73
|
-
let [s] = captureRegistration(() => describe.todo('suite'));
|
|
74
|
-
assert.equal(s.tests.length, 0);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
// ── it ────────────────────────────────────────────────────────────────────────
|
|
78
|
-
describe('it', () => {
|
|
79
|
-
it('has skip, only, and todo sub-functions', () => {
|
|
80
|
-
assert.equal(typeof it.skip, 'function');
|
|
81
|
-
assert.equal(typeof it.only, 'function');
|
|
82
|
-
assert.equal(typeof it.todo, 'function');
|
|
83
|
-
});
|
|
84
|
-
it('can be called outside describe (registers on implicit root suite)', () => {
|
|
85
|
-
let fn = () => { };
|
|
86
|
-
let captured = captureRegistration(() => it('orphan', fn));
|
|
87
|
-
let root = captured.find((s) => s.name === '');
|
|
88
|
-
assert.equal(root?.tests.some((t) => t.fn === fn), true);
|
|
89
|
-
});
|
|
90
|
-
it('registers a test with the given name and fn', () => {
|
|
91
|
-
let fn = () => { };
|
|
92
|
-
let [s] = captureRegistration(() => describe('suite', () => {
|
|
93
|
-
it('my test', fn);
|
|
94
|
-
}));
|
|
95
|
-
assert.equal(s.tests[0].name, 'my test');
|
|
96
|
-
assert.equal(s.tests[0].fn, fn);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
describe('it.skip', () => {
|
|
100
|
-
it('marks the test as skipped', () => {
|
|
101
|
-
let [s] = captureRegistration(() => describe('suite', () => {
|
|
102
|
-
it.skip('skipped test', () => { });
|
|
103
|
-
}));
|
|
104
|
-
assert.equal(s.tests[0].skip, true);
|
|
105
|
-
});
|
|
106
|
-
it('accepts an optional fn', () => {
|
|
107
|
-
let [s] = captureRegistration(() => describe('suite', () => {
|
|
108
|
-
it.skip('no fn');
|
|
109
|
-
}));
|
|
110
|
-
assert.equal(s.tests[0].skip, true);
|
|
111
|
-
assert.equal(typeof s.tests[0].fn, 'function');
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
describe('it.only', () => {
|
|
115
|
-
it('marks the test as only', () => {
|
|
116
|
-
let [s] = captureRegistration(() => describe('suite', () => {
|
|
117
|
-
it.only('only test', () => { });
|
|
118
|
-
}));
|
|
119
|
-
assert.equal(s.tests[0].only, true);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
describe('it.todo', () => {
|
|
123
|
-
it('marks the test as todo', () => {
|
|
124
|
-
let [s] = captureRegistration(() => describe('suite', () => {
|
|
125
|
-
it.todo('todo test');
|
|
126
|
-
}));
|
|
127
|
-
assert.equal(s.tests[0].todo, true);
|
|
128
|
-
assert.equal(s.tests[0].name, 'todo test');
|
|
129
|
-
});
|
|
130
|
-
it('can be called outside describe (registers on implicit root suite)', () => {
|
|
131
|
-
let captured = captureRegistration(() => it.todo('orphan'));
|
|
132
|
-
let root = captured.find((s) => s.name === '');
|
|
133
|
-
assert.equal(root?.tests[0]?.name, 'orphan');
|
|
134
|
-
assert.equal(root?.tests[0]?.todo, true);
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
// ── Duplicate detection ───────────────────────────────────────────────────────
|
|
138
|
-
describe('duplicate detection', () => {
|
|
139
|
-
it('throws on duplicate suite name', () => {
|
|
140
|
-
let suites = globalThis.__testSuites;
|
|
141
|
-
let before = suites.length;
|
|
142
|
-
try {
|
|
143
|
-
assert.throws(() => {
|
|
144
|
-
describe('__dup-suite__', () => { });
|
|
145
|
-
describe('__dup-suite__', () => { });
|
|
146
|
-
}, /Duplicate suite name: "__dup-suite__"/);
|
|
147
|
-
}
|
|
148
|
-
finally {
|
|
149
|
-
suites.splice(before);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
it('throws on duplicate describe.todo name', () => {
|
|
153
|
-
let suites = globalThis.__testSuites;
|
|
154
|
-
let before = suites.length;
|
|
155
|
-
try {
|
|
156
|
-
assert.throws(() => {
|
|
157
|
-
describe.todo('__dup-todo-suite__');
|
|
158
|
-
describe.todo('__dup-todo-suite__');
|
|
159
|
-
}, /Duplicate suite name: "__dup-todo-suite__"/);
|
|
160
|
-
}
|
|
161
|
-
finally {
|
|
162
|
-
suites.splice(before);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
it('throws on duplicate test name within a suite', () => {
|
|
166
|
-
assert.throws(() => captureRegistration(() => describe('suite', () => {
|
|
167
|
-
it('same name', () => { });
|
|
168
|
-
it('same name', () => { });
|
|
169
|
-
})), /Duplicate test name: "same name" in suite "suite"/);
|
|
170
|
-
});
|
|
171
|
-
it('throws on duplicate it.todo name within a suite', () => {
|
|
172
|
-
assert.throws(() => captureRegistration(() => describe('suite', () => {
|
|
173
|
-
it.todo('same name');
|
|
174
|
-
it.todo('same name');
|
|
175
|
-
})), /Duplicate test name: "same name" in suite "suite"/);
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
// ── Aliases ───────────────────────────────────────────────────────────────────
|
|
179
|
-
describe('suite alias', () => {
|
|
180
|
-
it('is an alias for describe', () => {
|
|
181
|
-
assert.equal(suite, describe);
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
describe('test alias', () => {
|
|
185
|
-
it('is an alias for it', () => {
|
|
186
|
-
assert.equal(test, it);
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
// ── Lifecycle hooks ───────────────────────────────────────────────────────────
|
|
190
|
-
describe('lifecycle hooks', () => {
|
|
191
|
-
it('beforeEach registers on the current suite', () => {
|
|
192
|
-
let fn = () => { };
|
|
193
|
-
let [s] = captureRegistration(() => describe('suite', () => {
|
|
194
|
-
beforeEach(fn);
|
|
195
|
-
}));
|
|
196
|
-
assert.equal(s.beforeEach, fn);
|
|
197
|
-
});
|
|
198
|
-
it('afterEach registers on the current suite', () => {
|
|
199
|
-
let fn = () => { };
|
|
200
|
-
let [s] = captureRegistration(() => describe('suite', () => {
|
|
201
|
-
afterEach(fn);
|
|
202
|
-
}));
|
|
203
|
-
assert.equal(s.afterEach, fn);
|
|
204
|
-
});
|
|
205
|
-
it('beforeAll registers on the current suite', () => {
|
|
206
|
-
let fn = () => { };
|
|
207
|
-
let [s] = captureRegistration(() => describe('suite', () => {
|
|
208
|
-
beforeAll(fn);
|
|
209
|
-
}));
|
|
210
|
-
assert.equal(s.beforeAll, fn);
|
|
211
|
-
});
|
|
212
|
-
it('afterAll registers on the current suite', () => {
|
|
213
|
-
let fn = () => { };
|
|
214
|
-
let [s] = captureRegistration(() => describe('suite', () => {
|
|
215
|
-
afterAll(fn);
|
|
216
|
-
}));
|
|
217
|
-
assert.equal(s.afterAll, fn);
|
|
218
|
-
});
|
|
219
|
-
it('beforeEach can be called outside describe (registers on root hooks)', () => {
|
|
220
|
-
// Just verify it doesn't throw — root-level hooks are tested via inheritance
|
|
221
|
-
assert.doesNotThrow(() => {
|
|
222
|
-
let [s] = captureRegistration(() => {
|
|
223
|
-
beforeEach(() => { });
|
|
224
|
-
describe('suite', () => { });
|
|
225
|
-
});
|
|
226
|
-
assert.equal(typeof s.beforeEach, 'function');
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
it('afterEach can be called outside describe (registers on root hooks)', () => {
|
|
230
|
-
assert.doesNotThrow(() => {
|
|
231
|
-
let [s] = captureRegistration(() => {
|
|
232
|
-
afterEach(() => { });
|
|
233
|
-
describe('suite', () => { });
|
|
234
|
-
});
|
|
235
|
-
assert.equal(typeof s.afterEach, 'function');
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
it('beforeAll can be called outside describe (registers on root hooks)', () => {
|
|
239
|
-
assert.doesNotThrow(() => {
|
|
240
|
-
let [s] = captureRegistration(() => {
|
|
241
|
-
beforeAll(() => { });
|
|
242
|
-
describe('suite', () => { });
|
|
243
|
-
});
|
|
244
|
-
assert.equal(typeof s.beforeAll, 'function');
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
it('afterAll can be called outside describe (registers on root hooks)', () => {
|
|
248
|
-
assert.doesNotThrow(() => {
|
|
249
|
-
let [s] = captureRegistration(() => {
|
|
250
|
-
afterAll(() => { });
|
|
251
|
-
describe('suite', () => { });
|
|
252
|
-
});
|
|
253
|
-
assert.equal(typeof s.afterAll, 'function');
|
|
254
|
-
});
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
describe('Example Test Suite', () => {
|
|
258
|
-
it('passes basic equality', () => {
|
|
259
|
-
assert.equal(1 + 1, 2);
|
|
260
|
-
});
|
|
261
|
-
it('passes deep equality', () => {
|
|
262
|
-
assert.deepEqual({ a: 1, b: 2 }, { a: 1, b: 2 });
|
|
263
|
-
});
|
|
264
|
-
it('can test async code', async () => {
|
|
265
|
-
let result = await Promise.resolve(42);
|
|
266
|
-
assert.equal(result, 42);
|
|
267
|
-
});
|
|
268
|
-
it('can assert throws', () => {
|
|
269
|
-
assert.throws(() => {
|
|
270
|
-
throw new Error('test error');
|
|
271
|
-
}, /test error/);
|
|
272
|
-
});
|
|
273
|
-
it.skip('skip: can skip tests', () => {
|
|
274
|
-
assert.equal(true, false);
|
|
275
|
-
});
|
|
276
|
-
it.todo('todo: can mark tests as todo');
|
|
277
|
-
});
|
|
278
|
-
describe.skip('skip: Skipped Test Suite', () => {
|
|
279
|
-
it('would fail', () => {
|
|
280
|
-
assert.equal(true, false);
|
|
281
|
-
});
|
|
282
|
-
});
|
|
283
|
-
describe.todo('todo: Test Suite');
|
package/dist/lib/utils.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export type Counts = {
|
|
2
|
-
passed: number;
|
|
3
|
-
failed: number;
|
|
4
|
-
skipped: number;
|
|
5
|
-
todo: number;
|
|
6
|
-
};
|
|
7
|
-
export declare const colors: {
|
|
8
|
-
reset: string;
|
|
9
|
-
dim: (s: string) => string;
|
|
10
|
-
green: (s: string) => string;
|
|
11
|
-
red: (s: string) => string;
|
|
12
|
-
cyan: (s: string) => string;
|
|
13
|
-
yellow: (s: string) => string;
|
|
14
|
-
};
|
|
15
|
-
export declare function normalizeLine(line: string): string;
|
|
16
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/lib/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAID,eAAO,MAAM,MAAM;;;;;;;CAOlB,CAAA;AAcD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CASlD"}
|
package/src/lib/e2e-server.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as http from 'node:http'
|
|
2
|
-
import { createRequestListener } from '@remix-run/node-fetch-server'
|
|
3
|
-
|
|
4
|
-
export interface CreateServerFunction {
|
|
5
|
-
(handler: (req: Request) => Promise<Response>): Promise<{
|
|
6
|
-
baseUrl: string
|
|
7
|
-
close(): Promise<void>
|
|
8
|
-
}>
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function createServer(handler: (req: Request) => Promise<Response>): Promise<{
|
|
12
|
-
baseUrl: string
|
|
13
|
-
close(): Promise<void>
|
|
14
|
-
}> {
|
|
15
|
-
return new Promise((resolve, reject) => {
|
|
16
|
-
let server = http.createServer(createRequestListener(handler))
|
|
17
|
-
|
|
18
|
-
server.listen(0, '127.0.0.1', () => {
|
|
19
|
-
let addr = server.address() as { port: number }
|
|
20
|
-
resolve({
|
|
21
|
-
baseUrl: `http://127.0.0.1:${addr.port}`,
|
|
22
|
-
close: () => new Promise((r, rj) => server.close((e) => (e ? rj(e) : r()))),
|
|
23
|
-
})
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
server.on('error', reject)
|
|
27
|
-
})
|
|
28
|
-
}
|
|
File without changes
|