meta { name: node-path type: http seq: 11 } get { url: {{host}}/ping body: none auth: none } script:pre-request { // Skip in safe mode - these tests require developer sandbox if (bru.isSafeMode()) { bru.runner.skipRequest(); return; } } tests { const path = require('node:path'); test("path.resolve", function() { const resolved = path.resolve('foo', 'bar'); expect(path.isAbsolute(resolved)).to.equal(true); }); test("path.dirname and path.basename", function() { expect(path.basename('/foo/bar/baz.txt')).to.equal('baz.txt'); expect(path.basename('/foo/bar/baz.txt', '.txt')).to.equal('baz'); }); test("path.extname", function() { expect(path.extname('file.txt')).to.equal('.txt'); expect(path.extname('file')).to.equal(''); expect(path.extname('.gitignore')).to.equal(''); }); test("path.parse and path.format", function() { const parsed = path.parse('/foo/bar/baz.txt'); expect(parsed.base).to.equal('baz.txt'); expect(parsed.name).to.equal('baz'); expect(parsed.ext).to.equal('.txt'); }); test("path.isAbsolute", function() { expect(path.isAbsolute('/foo/bar')).to.equal(true); expect(path.isAbsolute('foo/bar')).to.equal(false); }); test("path.sep and path.delimiter", function() { expect(path.sep).to.be.a('string'); expect(path.delimiter).to.be.a('string'); }); }