Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: delete fixtures #297

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"get-node": "^13.5.0",
"kolorist": "^1.6.0",
"lint-staged": "^13.1.0",
"manten": "^0.6.0",
"manten": "^1.1.0",
"node-pty": "^1.0.0",
"pkgroll": "^1.8.0",
"semver": "^7.3.8",
Expand Down
148 changes: 87 additions & 61 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ const nodeVersions = [

(async () => {
for (const packageType of packageTypes) {
await describe(`Package type: ${packageType}`, async ({ describe }) => {
await describe(`Package type: ${packageType}`, async ({ describe, onFinish }) => {
const fixture = await createFixture('./tests/fixtures/');

onFinish(async () => await fixture.rm());

await fixture.writeJson('package.json', {
type: packageType,
});
Expand Down Expand Up @@ -72,8 +74,6 @@ const nodeVersions = [
);
});
}

await fixture.rm();
});
}
})();
9 changes: 6 additions & 3 deletions tests/specs/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ export default testSuite(async ({ describe }, fixturePath: string) => {
expect(tsxProcess.stderr).toMatch('Error: Missing required parameter "script path"');
});

test('watch files for changes', async () => {
test('watch files for changes', async ({ onTestFinish }) => {
const fixture = await createFixture({
'index.js': 'console.log(1)',
});

onTestFinish(async () => await fixture.rm());

const tsxProcess = tsx({
args: [
'watch',
Expand Down Expand Up @@ -142,7 +144,7 @@ export default testSuite(async ({ describe }, fixturePath: string) => {
});

describe('ignore', ({ test }) => {
test('file path & glob', async () => {
test('file path & glob', async ({ onTestFinish }) => {
const entryFile = 'index.js';
const fileA = 'file-a.js';
const fileB = 'directory/file-b.js';
Expand All @@ -158,6 +160,8 @@ export default testSuite(async ({ describe }, fixturePath: string) => {
[fileB]: `export default ${value}`,
});

onTestFinish(async () => await fixture.rm());

const tsxProcess = tsx({
cwd: fixture.path,
args: [
Expand Down Expand Up @@ -188,7 +192,6 @@ export default testSuite(async ({ describe }, fixturePath: string) => {
});

const tsxProcessResolved = await tsxProcess;
await fixture.rm();

expect(tsxProcessResolved.stdout).not.toMatch(`${value} ${value}`);
expect(tsxProcessResolved.stderr).toBe('');
Expand Down
Loading