Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/share/.cache/yarn/v6/npm-tape-5.6.1-integrity/node_modules/tape/test/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict';
var tap = require('tap');
var path = require('path');
var exec = require('child_process').exec;
var stripFullStack = require('./common').stripFullStack;
var tapeBin = 'node ' + path.join(__dirname, '../bin/tape');
var expectedExitCodeFailure = (/^0\.10\.\d+$/).test(process.versions.node);
var expectedStackTraceBug = (/^3\.[012]\.\d+$/).test(process.versions.node); // https://github.com/nodejs/node/issues/2581
tap.test(
'Should throw error when --no-only is passed via cli and there is a .only test',
{ todo: expectedExitCodeFailure || expectedStackTraceBug ? 'Fails on these node versions' : false },
function (tt) {
tt.plan(3);
exec(tapeBin + ' --no-only "**/*.js"', {
cwd: path.join(__dirname, 'no_only')
}, function (err, stdout, stderr) {
tt.same(stdout.toString('utf8'), '');
tt.match(stripFullStack(stderr.toString('utf8')).join('\n'), /Error: `only` tests are prohibited\n/);
tt.equal(err.code, 1);
});
}
);
tap.test(
'Should throw error when NODE_TAPE_NO_ONLY_TEST is passed via envs and there is an .only test',
{ todo: expectedExitCodeFailure || expectedStackTraceBug ? 'Fails on these node versions' : false },
function (tt) {
tt.plan(3);
exec(tapeBin + ' "**/*.js"', {
cwd: path.join(__dirname, 'no_only'),
env: { PATH: process.env.PATH, NODE_TAPE_NO_ONLY_TEST: 'true' }
}, function (err, stdout, stderr) {
tt.same(stdout.toString('utf8'), '');
tt.match(stripFullStack(stderr.toString('utf8')).join('\n'), /Error: `only` tests are prohibited\n/);
tt.equal(err.code, 1);
});
}
);
tap.test(
'Should override NODE_TAPE_NO_ONLY_TEST env if --no-only is passed from cli',
{ todo: expectedExitCodeFailure || expectedStackTraceBug ? 'Fails on these node versions' : false },
function (tt) {
tt.plan(3);
exec(tapeBin + ' --no-only "**/*.js"', {
cwd: path.join(__dirname, 'no_only'),
env: { PATH: process.env.PATH, NODE_TAPE_NO_ONLY_TEST: 'false' }
}, function (err, stdout, stderr) {
tt.same(stdout.toString('utf8'), '');
tt.match(stripFullStack(stderr.toString('utf8')).join('\n'), /Error: `only` tests are prohibited\n/);
tt.equal(err.code, 1);
});
}
);
tap.test('Should run successfully if there is no only test', function (tt) {
tt.plan(3);
exec(tapeBin + ' --no-only "**/test-a.js"', {
cwd: path.join(__dirname, 'no_only')
}, function (err, stdout, stderr) {
tt.match(stderr.toString('utf8'), /^\s*(\(node:\d+\) ExperimentalWarning: The ESM module loader is experimental\.)?\s*$/);
tt.same(stripFullStack(stdout.toString('utf8')), [
'TAP version 13',
'# should pass',
'ok 1 should be truthy',
'',
'1..1',
'# tests 1',
'# pass 1',
'',
'# ok',
'',
''
]);
tt.equal(err, null); // code 0
});
});
tap.test('Should run successfully if there is an only test and no --no-only flag', function (tt) {
tt.plan(3);
exec(tapeBin + ' "**/test-b.js"', {
cwd: path.join(__dirname, 'no_only')
}, function (err, stdout, stderr) {
tt.same(stripFullStack(stdout.toString('utf8')), [
'TAP version 13',
'# should pass again',
'ok 1 should be truthy',
'',
'1..1',
'# tests 1',
'# pass 1',
'',
'# ok',
'',
''
]);
tt.match(stderr.toString('utf8'), /^\s*(\(node:\d+\) ExperimentalWarning: The ESM module loader is experimental\.)?\s*$/);
tt.equal(err, null); // code 0
});
});
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0095 ]-- |