Skip to content

Commit 5bddd48

Browse files
committed
skip transpile tests when leaktest
1 parent 59730d6 commit 5bddd48

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed
Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
import path from 'node:path';
22
import { pathToFileURL } from 'node:url';
3-
import { expect, it } from 'vitest';
3+
import { describe, expect, it } from 'vitest';
44
import { transpileTypeScriptFile } from '../src/transpile';
55

6-
it('should transpile basic typescript file', async () => {
7-
const url = pathToFileURL(path.join(__dirname, 'fixtures', 'basic.ts'));
8-
const { format, source } = await transpileTypeScriptFile(url.toString());
9-
expect(format).toMatchInlineSnapshot(`"module"`);
10-
expect(source.trim()).toMatchInlineSnapshot(`"export const str = 'ing';"`);
11-
});
6+
describe.skipIf(process.env['LEAK_TEST'])('Transpile', () => {
7+
it('should transpile basic typescript file', async () => {
8+
const url = pathToFileURL(path.join(__dirname, 'fixtures', 'basic.ts'));
9+
const { format, source } = await transpileTypeScriptFile(url.toString());
10+
expect(format).toMatchInlineSnapshot(`"module"`);
11+
expect(source.trim()).toMatchInlineSnapshot(`"export const str = 'ing';"`);
12+
});
1213

13-
it.skipIf(
14-
// bun has issues with the snapshot. it looks exactly the same but bun claims it doesnt match
15-
globalThis.Bun,
16-
)('should transpile basic typescript commonjs file', async () => {
17-
const url = pathToFileURL(path.join(__dirname, 'fixtures', 'basic.cts'));
18-
const { format, source } = await transpileTypeScriptFile(url.toString());
19-
expect(format).toMatchInlineSnapshot(`"commonjs"`);
20-
expect(source.trim()).toMatchInlineSnapshot(`
21-
""use strict";const str = 'ing';
22-
module.exports = { str };"`);
23-
});
14+
it.skipIf(
15+
// bun has issues with the snapshot. it looks exactly the same but bun claims it doesnt match
16+
globalThis.Bun,
17+
)('should transpile basic typescript commonjs file', async () => {
18+
const url = pathToFileURL(path.join(__dirname, 'fixtures', 'basic.cts'));
19+
const { format, source } = await transpileTypeScriptFile(url.toString());
20+
expect(format).toMatchInlineSnapshot(`"commonjs"`);
21+
expect(source.trim()).toMatchInlineSnapshot(`
22+
""use strict";const str = 'ing';
23+
module.exports = { str };"`);
24+
});
2425

25-
it('should fail transpiling typescript file with syntax error and file location', async () => {
26-
const url = pathToFileURL(
27-
path.join(__dirname, 'fixtures', 'syntax-error.ts'),
28-
);
29-
await expect(transpileTypeScriptFile(url.toString())).rejects.toThrowError(
30-
// we include the starting forwardslash and the project path because we want to make sure the absolute path is reported
31-
/Error transforming \/(.*)\/packages\/importer\/tests\/fixtures\/syntax-error.ts: Unexpected token, expected ";" \(2:11\)/,
32-
);
26+
it('should fail transpiling typescript file with syntax error and file location', async () => {
27+
const url = pathToFileURL(
28+
path.join(__dirname, 'fixtures', 'syntax-error.ts'),
29+
);
30+
await expect(transpileTypeScriptFile(url.toString())).rejects.toThrowError(
31+
// we include the starting forwardslash and the project path because we want to make sure the absolute path is reported
32+
/Error transforming \/(.*)\/packages\/importer\/tests\/fixtures\/syntax-error.ts: Unexpected token, expected ";" \(2:11\)/,
33+
);
34+
});
3335
});

0 commit comments

Comments
 (0)