@@ -2,8 +2,7 @@ import { testSuite, expect } from 'manten';
22import semver from 'semver' ;
33import type { NodeApis } from '../../utils/node-with-loader' ;
44import nodeSupports from '../../utils/node-supports' ;
5-
6- const isWin = process . platform === 'win32' ;
5+ import { assertNotFound } from '../../utils/assertions' ;
76
87export default testSuite ( async ( { describe } , node : NodeApis ) => {
98 describe ( '.mts extension' , ( { describe } ) => {
@@ -41,7 +40,7 @@ export default testSuite(async ({ describe }, node: NodeApis) => {
4140
4241 test ( 'Load - should not work' , async ( ) => {
4342 const nodeProcess = await node . load ( importPath ) ;
44- expect ( nodeProcess . stderr ) . toMatch ( 'Cannot find module' ) ;
43+ assertNotFound ( nodeProcess . stderr , importPath ) ;
4544 } ) ;
4645
4746 test ( 'Import' , async ( ) => {
@@ -56,36 +55,26 @@ export default testSuite(async ({ describe }, node: NodeApis) => {
5655
5756 test ( 'Load' , async ( ) => {
5857 const nodeProcess = await node . load ( importPath ) ;
59- expect ( nodeProcess . stderr ) . toMatch ( 'Cannot find module' ) ;
58+ assertNotFound ( nodeProcess . stderr , importPath ) ;
6059 } ) ;
6160
6261 test ( 'Import' , async ( ) => {
6362 const nodeProcess = await node . import ( importPath ) ;
64- expect ( nodeProcess . stderr ) . toMatch ( 'Cannot find module' ) ;
65- expect ( nodeProcess . stderr ) . toMatch (
66- isWin
67- ? '\\lib\\ts-ext-mts\\index\''
68- : '/lib/ts-ext-mts/index\'' ,
69- ) ;
63+ assertNotFound ( nodeProcess . stderr , importPath ) ;
7064 } ) ;
7165 } ) ;
7266
7367 describe ( 'directory - should not work' , ( { test } ) => {
74- const importPath = './lib/ts-ext-mts/ ' ;
68+ const importPath = './lib/ts-ext-mts' ;
7569
7670 test ( 'Load' , async ( ) => {
7771 const nodeProcess = await node . load ( importPath ) ;
78- expect ( nodeProcess . stderr ) . toMatch ( 'Cannot find module' ) ;
72+ assertNotFound ( nodeProcess . stderr , importPath ) ;
7973 } ) ;
8074
8175 test ( 'Import' , async ( ) => {
8276 const nodeProcess = await node . import ( importPath ) ;
83- expect ( nodeProcess . stderr ) . toMatch ( 'Cannot find module' ) ;
84- expect ( nodeProcess . stderr ) . toMatch (
85- isWin
86- ? '\\lib\\ts-ext-mts\\\''
87- : '/lib/ts-ext-mts/\'' ,
88- ) ;
77+ assertNotFound ( nodeProcess . stderr , importPath ) ;
8978 } ) ;
9079 } ) ;
9180 } ) ;
0 commit comments