UNPKG

testeranto

Version:

the AI powered BDD test framework for typescript projects

22 lines (21 loc) 871 B
import { isBuiltin } from "node:module"; export const nativeImportDetectorPlugin = { name: "native-node-import-filter", setup(build) { build.onResolve({ filter: /fs/ }, (args) => { if (isBuiltin(args.path)) { return { warnings: [ { text: `cannot use native node package "${args.path}" in a "pure" test. If you really want to use this package, convert this test from "pure" to "node"`, }, ], }; // throw new Error( // `cannot use native node package "${args.path}" in a "pure" test. If you really want to use this package, convert this test from "pure" to "node"` // ); } return { path: args.path }; }); }, };