1- import test from 'ava' ;
1+ import { test } from 'node:test' ;
2+ import { strict as assert } from 'node:assert' ;
23import esmock from 'esmock' ;
34
4- test ( 'detects Docker via /.dockerenv' , async t => {
5+ test ( 'detects Docker via /.dockerenv' , async ( ) => {
56 const isDocker = await esmock ( './index.js' , {
67 'node:fs' : {
78 statSync ( path ) {
@@ -17,10 +18,10 @@ test('detects Docker via /.dockerenv', async t => {
1718 } ,
1819 } ) ;
1920
20- t . true ( isDocker . default ( ) ) ;
21+ assert . equal ( isDocker . default ( ) , true ) ;
2122} ) ;
2223
23- test ( 'detects Docker via /proc/self/cgroup' , async t => {
24+ test ( 'detects Docker via /proc/self/cgroup' , async ( ) => {
2425 const isDocker = await esmock ( './index.js' , {
2526 'node:fs' : {
2627 statSync ( ) {
@@ -36,10 +37,10 @@ test('detects Docker via /proc/self/cgroup', async t => {
3637 } ,
3738 } ) ;
3839
39- t . true ( isDocker . default ( ) ) ;
40+ assert . equal ( isDocker . default ( ) , true ) ;
4041} ) ;
4142
42- test ( 'detects Docker via /proc/self/mountinfo' , async t => {
43+ test ( 'detects Docker via /proc/self/mountinfo' , async ( ) => {
4344 const isDocker = await esmock ( './index.js' , {
4445 'node:fs' : {
4546 statSync ( ) {
@@ -59,10 +60,10 @@ test('detects Docker via /proc/self/mountinfo', async t => {
5960 } ,
6061 } ) ;
6162
62- t . true ( isDocker . default ( ) ) ;
63+ assert . equal ( isDocker . default ( ) , true ) ;
6364} ) ;
6465
65- test ( 'not inside Docker container' , async t => {
66+ test ( 'not inside Docker container' , async ( ) => {
6667 const isDocker = await esmock ( './index.js' , {
6768 'node:fs' : {
6869 statSync ( ) {
@@ -74,10 +75,10 @@ test('not inside Docker container', async t => {
7475 } ,
7576 } ) ;
7677
77- t . false ( isDocker . default ( ) ) ;
78+ assert . equal ( isDocker . default ( ) , false ) ;
7879} ) ;
7980
80- test ( 'caching works correctly' , async t => {
81+ test ( 'caching works correctly' , async ( ) => {
8182 let statSyncCallCount = 0 ;
8283 let readFileSyncCallCount = 0 ;
8384
@@ -99,12 +100,12 @@ test('caching works correctly', async t => {
99100 } ) ;
100101
101102 // First call
102- t . true ( isDocker . default ( ) ) ;
103- t . is ( statSyncCallCount , 1 ) ;
104- t . is ( readFileSyncCallCount , 1 ) ;
103+ assert . equal ( isDocker . default ( ) , true ) ;
104+ assert . equal ( statSyncCallCount , 1 ) ;
105+ assert . equal ( readFileSyncCallCount , 1 ) ;
105106
106107 // Second call - should use cache
107- t . true ( isDocker . default ( ) ) ;
108- t . is ( statSyncCallCount , 1 ) ; // Should not increase
109- t . is ( readFileSyncCallCount , 1 ) ; // Should not increase
108+ assert . equal ( isDocker . default ( ) , true ) ;
109+ assert . equal ( statSyncCallCount , 1 ) ; // Should not increase
110+ assert . equal ( readFileSyncCallCount , 1 ) ; // Should not increase
110111} ) ;
0 commit comments