Skip to content

Instantly share code, notes, and snippets.

@radekbenkel
Last active February 12, 2025 09:01
Show Gist options
  • Select an option

  • Save radekbenkel/6cede03ae57d93d5d238667476e1851c to your computer and use it in GitHub Desktop.

Select an option

Save radekbenkel/6cede03ae57d93d5d238667476e1851c to your computer and use it in GitHub Desktop.
nock@14 & testcontainers
import { GenericContainer } from 'testcontainers';
import nock from 'nock';
const container = new GenericContainer("alpine");
const startedContainer = await container.start();
console.info('Container started');
await startedContainer.stop();
console.info('Container stopped');
{
"name": "nock-testcontainers-test",
"version": "1.0.0",
"main": "index.mjs",
"scripts": {
"broken": "node broken.mjs",
"working": "node working.mjs"
},
"devDependencies": {
"nock": "^14.0.1",
"testcontainers": "^10.17.2"
}
}
import { GenericContainer } from 'testcontainers';
// uncomment next line to see bug
// import nock from 'nock';
const container = new GenericContainer("alpine");
const startedContainer = await container.start();
console.info('Container started');
await startedContainer.stop();
console.info('Container stopped');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment