cp dist/*.js ts
cp -r dist/generated/ ts
# Use a dedicated ts-node project: the upstream tsconfig.json makes ts-node
# fail under typescript 6 (implicit node10 module resolution, no explicit
# rootDir), and TS_NODE_SCOPE keeps ts-node from compiling the .js of the
# modules loaded with --require.
cat >tsconfig-autopkgtest.json <<CONF
{
  "compilerOptions": {
    "target": "ES2021",
    "module": "commonjs",
    "lib": ["ES2021", "dom"],
    "allowJs": true,
    "esModuleInterop": true,
    "strict": false,
    "types": ["node", "mocha"],
    "rootDir": "."
  },
  "include": ["ts/**/*"]
}
CONF
TS_NODE_PROJECT=tsconfig-autopkgtest.json TS_NODE_TRANSPILE_ONLY=true TS_NODE_SCOPE=true mocha -t 60000 'ts/**/*.test.ts' --no-config --extension js,ts,tsx --require ts-node/register --require source-map-support/register
