Skip to content

Commit f49c9a5

Browse files
committed
Split test tests
1 parent 31c4029 commit f49c9a5

1 file changed

Lines changed: 27 additions & 15 deletions

File tree

tests/tests.test.mjs

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
import { beforeAll, describe, it, expect } from 'vitest';
1+
import { describe, it, expect } from 'vitest';
22
import fixturify from 'fixturify';
33
import stripAnsi from 'strip-ansi';
44

55
import { generateApp } from './helpers.mjs';
66

77
describe('Slow(JavaScript): Runs tests', async function () {
8-
let app;
9-
10-
beforeAll(async function () {
11-
app = await generateApp({ flags: ['--pnpm'], skipNpm: false });
12-
});
13-
148
it('runs in a freshly generated app', async function () {
9+
let app = await generateApp({ flags: ['--pnpm'], skipNpm: false });
10+
1511
let { stdout: stdout1, exitCode: exitCode1 } = await app.execa('pnpm', [
1612
'test',
1713
]);
@@ -26,6 +22,10 @@ describe('Slow(JavaScript): Runs tests', async function () {
2622
expect(stdout1).to.contain('# todo 0');
2723
expect(stdout1).to.contain('# ok');
2824
expect(exitCode1).to.equal(0);
25+
});
26+
27+
it('runs in an app with fixtures', async function () {
28+
let app = await generateApp({ flags: ['--pnpm'], skipNpm: false });
2929

3030
fixturify.writeSync(
3131
app.dir,
@@ -52,11 +52,14 @@ describe('Slow(JavaScript): Runs tests', async function () {
5252
expect(stdout2).to.contain('# todo 0');
5353
expect(stdout2).to.contain('# ok');
5454
expect(exitCode2).to.equal(0);
55+
});
5556

56-
let fixtures = fixturify.readSync('./tests/fixtures/tests-js-20');
57+
it('runs when serving /tests', async function () {
58+
let app = await generateApp({ flags: ['--pnpm'], skipNpm: false });
5759

5860
await app.execa('pnpm', ['install', '--save-dev', 'testem', 'http-proxy']);
5961

62+
let fixtures = fixturify.readSync('./tests/fixtures/tests-js-20');
6063
let server;
6164

6265
try {
@@ -97,16 +100,12 @@ describe('Slow(JavaScript): Runs tests', async function () {
97100
});
98101

99102
describe('Slow(TypeScript): Runs tests', async function () {
100-
let app;
101-
102-
beforeAll(async function () {
103-
app = await generateApp({
103+
it('runs in a freshly generated app', async function () {
104+
let app = await generateApp({
104105
flags: ['--pnpm', '--typescript'],
105106
skipNpm: false,
106107
});
107-
});
108108

109-
it('runs in a freshly generated app', async function () {
110109
let { stdout: stdout1, exitCode: exitCode1 } = await app.execa('pnpm', [
111110
'test',
112111
]);
@@ -121,6 +120,13 @@ describe('Slow(TypeScript): Runs tests', async function () {
121120
expect(stdout1).to.contain('# todo 0');
122121
expect(stdout1).to.contain('# ok');
123122
expect(exitCode1).to.equal(0);
123+
});
124+
125+
it('runs in an app with fixtures', async function () {
126+
let app = await generateApp({
127+
flags: ['--pnpm', '--typescript'],
128+
skipNpm: false,
129+
});
124130

125131
fixturify.writeSync(
126132
app.dir,
@@ -147,11 +153,17 @@ describe('Slow(TypeScript): Runs tests', async function () {
147153
expect(stdout2).to.contain('# todo 0');
148154
expect(stdout2).to.contain('# ok');
149155
expect(exitCode2).to.equal(0);
156+
});
150157

151-
let fixtures = fixturify.readSync('./tests/fixtures/tests-js-20');
158+
it('runs when serving /tests', async function () {
159+
let app = await generateApp({
160+
flags: ['--pnpm', '--typescript'],
161+
skipNpm: false,
162+
});
152163

153164
await app.execa('pnpm', ['install', '--save-dev', 'testem', 'http-proxy']);
154165

166+
let fixtures = fixturify.readSync('./tests/fixtures/tests-js-20');
155167
let server;
156168

157169
try {

0 commit comments

Comments
 (0)