Son CV dans un terminal web en Javascript!
https://terminal-cv.gregandev.fr
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
755 B
35 lines
755 B
2 years ago
|
'use strict';
|
||
|
|
||
|
var test = require('tap').test;
|
||
|
var path = require('path');
|
||
|
var threadId = require('../thread-id');
|
||
|
|
||
|
var Worker;
|
||
|
try {
|
||
|
Worker = require('worker_threads').Worker;
|
||
|
} catch (e) {}
|
||
|
|
||
|
test('the main process has thread -1', function(t) {
|
||
|
t.equal(threadId, -1);
|
||
|
t.end();
|
||
|
});
|
||
|
|
||
|
if (Worker != null) {
|
||
|
test('workers have positive integer threadIds', function(t) {
|
||
|
t.plan(2);
|
||
|
|
||
|
var w1 = new Worker(
|
||
|
path.join(__dirname, '../fixtures/thread-id-test-worker.js'),
|
||
|
);
|
||
|
w1.once('message', function(message) {
|
||
|
t.equal(message, 1);
|
||
|
});
|
||
|
var w2 = new Worker(
|
||
|
path.join(__dirname, '../fixtures/thread-id-test-worker.js'),
|
||
|
);
|
||
|
w2.once('message', function(message) {
|
||
|
t.equal(message, 2);
|
||
|
});
|
||
|
});
|
||
|
}
|