| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -242,3 +242,23 @@ test('check syntax error is thrown when passing invalid syntax with --input-type | |||
| 242 | 242 | match(result.stderr, /ERR_INVALID_TYPESCRIPT_SYNTAX/); | |
| 243 | 243 | strictEqual(result.code, 1); | |
| 244 | 244 | }); | |
| 245 | + | ||
| 246 | + test('should not allow module keyword', async () => { | ||
| 247 | + const result = await spawnPromisified(process.execPath, [ | ||
| 248 | + '--input-type=module-typescript', | ||
| 249 | + '--eval', | ||
| 250 | + 'module F { export type x = number }']); | ||
| 251 | + strictEqual(result.stdout, ''); | ||
| 252 | + match(result.stderr, /ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX/); | ||
| 253 | + strictEqual(result.code, 1); | ||
| 254 | + }); | ||
| 255 | + | ||
| 256 | + test('should not allow declare module keyword', async () => { | ||
| 257 | + const result = await spawnPromisified(process.execPath, [ | ||
| 258 | + '--input-type=module-typescript', | ||
| 259 | + '--eval', | ||
| 260 | + 'declare module F { export type x = number }']); | ||
| 261 | + strictEqual(result.stdout, ''); | ||
| 262 | + match(result.stderr, /ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX/); | ||
| 263 | + strictEqual(result.code, 1); | ||
| 264 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -85,9 +85,10 @@ test('execute a TypeScript file with legacy-module', async () => { | |||
| 85 | 85 | fixtures.path('typescript/ts/transformation/test-legacy-module.ts'), | |
| 86 | 86 | ]); | |
| 87 | 87 | ||
| 88 | - strictEqual(result.stderr, ''); | ||
| 89 | - match(result.stdout, /Hello, TypeScript!/); | ||
| 90 | - strictEqual(result.code, 0); | ||
| 88 | + match(result.stderr, /ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX/); | ||
| 89 | + match(result.stderr, /`module` keyword is not supported\. Use `namespace` instead/); | ||
| 90 | + strictEqual(result.stdout, ''); | ||
| 91 | + strictEqual(result.code, 1); | ||
| 91 | 92 | }); | |
| 92 | 93 | ||
| 93 | 94 | test('execute a TypeScript file with modern typescript syntax', async () => { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments