|
| 1 | +import { mustCall } from '../common/index.mjs'; |
| 2 | +import { fileURL, path } from '../common/fixtures.mjs'; |
| 3 | +import { match, notStrictEqual } from 'assert'; |
| 4 | +import { spawn } from 'child_process'; |
| 5 | +import { execPath } from 'process'; |
| 6 | + |
| 7 | +const child = spawn(execPath, [ |
| 8 | + '--no-warnings', |
| 9 | + '--throw-deprecation', |
| 10 | + '--experimental-loader', |
| 11 | + fileURL('es-module-loaders', 'hooks-obsolete.mjs').href, |
| 12 | + path('print-error-message.js'), |
| 13 | +]); |
| 14 | + |
| 15 | +let stderr = ''; |
| 16 | +child.stderr.setEncoding('utf8'); |
| 17 | +child.stderr.on('data', (data) => { |
| 18 | + stderr += data; |
| 19 | +}); |
| 20 | +child.on('close', mustCall((code, _signal) => { |
| 21 | + notStrictEqual(code, 0); |
| 22 | + |
| 23 | + // DeprecationWarning: Obsolete loader hook(s) supplied and will be ignored: |
| 24 | + // dynamicInstantiate, getFormat, getSource, transformSource |
| 25 | + match(stderr, /DeprecationWarning:/); |
| 26 | + match(stderr, /dynamicInstantiate/); |
| 27 | + match(stderr, /getFormat/); |
| 28 | + match(stderr, /getSource/); |
| 29 | + match(stderr, /transformSource/); |
| 30 | +})); |
0 commit comments