Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Install dependencies
run: npm install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest] #, windows-latest]
node-version: [16]
node-version: [20]

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
20
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"formatters"
],
"scripts": {
"test": "cross-env HTTP_PORT=0 LOG_LEVEL=fatal tap --no-coverage-report --no-cov --timeout 0 --test-regex=.test.js --test-ignore=node_modules",
"test:integration": "cross-env HTTP_PORT=0 LOG_LEVEL=fatal tap --no-coverage-report --no-cov --timeout 0 test/integration/**/*.test.js",
"test:unit": "cross-env HTTP_PORT=0 LOG_LEVEL=fatal tap --no-coverage-report --no-cov --timeout 0 test/*.test.js",
"test:tasks": "cross-env HTTP_PORT=0 LOG_LEVEL=fatal tap --no-coverage-report --no-cov --timeout 0 test/tasks/*.test.js",
"test": "cross-env HTTP_PORT=0 LOG_LEVEL=fatal tap --no-coverage-report --no-cov --timeout 0 --test-regex=.test.mjs --test-ignore=node_modules",
"test:integration": "cross-env HTTP_PORT=0 LOG_LEVEL=fatal tap --no-coverage-report --no-cov --timeout 0 test/integration/**/*.test.mjs",
"test:unit": "cross-env HTTP_PORT=0 LOG_LEVEL=fatal tap --no-coverage-report --no-cov --timeout 0 test/*.test.mjs",
"test:tasks": "cross-env HTTP_PORT=0 LOG_LEVEL=fatal tap --no-coverage-report --no-cov --timeout 0 test/tasks/*.test.mjs",
"test:ci:integration": "npm run test:integration -- --jobs=1",
"test:ci:unit": "npm run test:unit -- --jobs=1",
"test:ci:tasks": "npm run test:tasks -- --jobs=1",
Expand Down
33 changes: 19 additions & 14 deletions test/alias.test.js → test/alias.test.mjs
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
/* eslint-disable no-param-reassign */

'use strict';

const os = require('os');
const fs = require('fs').promises;
const { join, basename } = require('path');
const { test, beforeEach, afterEach } = require('tap');
const EikService = require('@eik/service');
const fastify = require('fastify');
const { sink } = require('@eik/core');
const { mockLogger } = require('./utils');
const cli = require('..');
import fastify from 'fastify';
import { promises as fs } from 'fs';
import os from 'os';
import { exec as execCallback } from 'child_process';
import { join, basename } from 'path';
import { mockLogger } from './utils.mjs';
import { test, beforeEach, afterEach } from 'tap';
import EikService from '@eik/service';
import { sink } from '@eik/core';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
import cli from '../classes/index.js';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

beforeEach(async (t) => {
const server = fastify({ logger: false });
const memSink = new sink.MEM();
const service = new EikService({ customSink: memSink });
server.register(service.api());
const address = await server.listen();
const address = await server.listen({
host: '127.0.0.1',
port: 0,
});

const token = await cli.login({
server: address,
Expand Down
35 changes: 19 additions & 16 deletions test/integration/alias.test.js → test/integration/alias.test.mjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
'use strict';

/* eslint-disable no-param-reassign */

const fastify = require('fastify');
const fs = require('fs').promises;
const os = require('os');
const cp = require('child_process');
const { join, basename } = require('path');
const { test, beforeEach, afterEach } = require('tap');
const fetch = require('node-fetch');
const EikService = require('@eik/service');
const { sink } = require('@eik/core');
const cli = require('../..');
import fastify from 'fastify';
import { promises as fs } from 'node:fs';
import os from 'node:os';
import { exec as execCallback } from 'child_process';
import { join, basename } from 'node:path';
import { test, beforeEach, afterEach } from 'tap';
import EikService from '@eik/service';
import { sink } from '@eik/core';
import cli from '../../classes/index.js';
import { fileURLToPath } from 'url';
import { dirname } from 'path';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

function exec(cmd) {
return new Promise((resolve) => {
cp.exec(cmd, (error, stdout, stderr) => {
execCallback(cmd, (error, stdout, stderr) => {
resolve({ error, stdout, stderr });
});
});
Expand All @@ -26,7 +26,10 @@ beforeEach(async (t) => {
const memSink = new sink.MEM();
const service = new EikService({ customSink: memSink });
server.register(service.api());
const address = await server.listen();
const address = await server.listen({
host: '127.0.0.1',
port: 0,
});
const folder = await fs.mkdtemp(join(os.tmpdir(), basename(__filename)));
const eik = join(__dirname, '../../index.js');

Expand Down
23 changes: 13 additions & 10 deletions test/integration/init.test.js → test/integration/init.test.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
'use strict';
import { promises as fs } from 'fs';
import os from 'os';
import { test } from 'tap';
import { join, basename } from 'path';
import { readFileSync } from 'fs';
import { exec as execCallback } from 'child_process';
import { fileURLToPath } from 'url';
import { dirname } from 'path';

const fs = require('fs').promises;
const os = require('os');
const { test } = require('tap');
const { join, basename } = require('path');
const { readFileSync } = require('fs');
const cp = require('child_process');
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

function exec(cmd) {
return new Promise((resolve) => {
cp.exec(cmd, (error, stdout, stderr) => {
execCallback(cmd, (error, stdout, stderr) => {
resolve({ error, stdout, stderr });
});
});
Expand All @@ -22,7 +25,7 @@ test('Initializing a new eik.json file', async (t) => {
const publishCmd = `${eik} init --cwd ${folder}`;
await exec(publishCmd);

const assets = JSON.parse(readFileSync(join(folder, 'eik.json')));
const assets = JSON.parse(readFileSync(join(folder, 'eik.json'), { encoding: 'utf8' }));

t.equal(assets.name, '', 'eik.json "name" field should be empty');
t.equal(
Expand All @@ -45,7 +48,7 @@ test('Initializing a new eik.json file passing custom values', async (t) => {
--server http://localhost:4001`;
await exec(publishCmd.split('\n').join(' '));

const assets = JSON.parse(readFileSync(join(folder, 'eik.json')));
const assets = JSON.parse(readFileSync(join(folder, 'eik.json'), { encoding: 'utf8' }));

t.equal(
assets.name,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
'use strict';

/* eslint-disable no-param-reassign */
const fastify = require('fastify');
const fs = require('fs').promises;
const os = require('os');
const cp = require('child_process');
const { join, basename } = require('path');
const { test, beforeEach, afterEach } = require('tap');
const EikService = require('@eik/service');
const { sink } = require('@eik/core');
const cli = require('../..');
import fastify from 'fastify';
import { promises as fs } from 'fs';
import os from 'os';
import { exec as execCallback } from 'child_process';
import { join, basename } from 'path';
import { test, beforeEach, afterEach } from 'tap';
import EikService from '@eik/service';
import { sink } from '@eik/core';
import cli from '../../classes/index.js';
import { fileURLToPath } from 'url';
import { dirname } from 'path';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

function exec(cmd) {
return new Promise((resolve) => {
cp.exec(cmd, (error, stdout, stderr) => {
execCallback(cmd, (error, stdout, stderr) => {
resolve({ error, stdout, stderr });
});
});
Expand All @@ -24,7 +26,10 @@ beforeEach(async (t) => {
const server = fastify({ logger: false });
const service = new EikService({ customSink: memSink });
server.register(service.api());
const address = await server.listen();
const address = await server.listen({
host: '127.0.0.1',
port: 0,
});
const folder = await fs.mkdtemp(join(os.tmpdir(), basename(__filename)));

const token = await cli.login({
Expand Down
33 changes: 18 additions & 15 deletions test/integration/login.test.js → test/integration/login.test.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/* eslint-disable no-param-reassign */

'use strict';

// const util = require('util');
const fastify = require('fastify');
const fs = require('fs').promises;
const os = require('os');
const cp = require('child_process');
const { join, basename } = require('path');
const { test, beforeEach, afterEach } = require('tap');
const EikService = require('@eik/service');
const { sink } = require('@eik/core');
import fastify from 'fastify';
import { promises as fs } from 'fs';
import os from 'os';
import { exec as execCallback } from 'child_process';
import { join, basename } from 'path';
import { test, beforeEach, afterEach } from 'tap';
import EikService from '@eik/service';
import { sink } from '@eik/core';
import { fileURLToPath } from 'url';
import { dirname } from 'path';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

function exec(cmd) {
return new Promise((resolve) => {
cp.exec(cmd, (error, stdout, stderr) => {
execCallback(cmd, (error, stdout, stderr) => {
resolve({ error, stdout, stderr });
});
});
Expand All @@ -25,7 +25,10 @@ beforeEach(async (t) => {
const server = fastify({ logger: false });
const service = new EikService({ customSink: memSink });
server.register(service.api());
const address = await server.listen();
const address = await server.listen({
host: '127.0.0.1',
port: 0,
});

const folder = await fs.mkdtemp(join(os.tmpdir(), basename(__filename)));

Expand Down
33 changes: 19 additions & 14 deletions test/integration/map.test.js → test/integration/map.test.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
'use strict';
import fastify from 'fastify';
import { promises as fs } from 'fs';
import os from 'os';
import { exec as execCallback } from 'child_process';
import { join, basename } from 'path';
import { test, beforeEach, afterEach } from 'tap';
import fetch from 'node-fetch';
import EikService from '@eik/service';
import { sink } from '@eik/core';
import cli from '../../classes/index.js';
import { fileURLToPath } from 'url';
import { dirname } from 'path';

/* eslint-disable no-param-reassign */
const fastify = require('fastify');
const fs = require('fs').promises;
const os = require('os');
const cp = require('child_process');
const { join, basename } = require('path');
const { test, beforeEach, afterEach } = require('tap');
const fetch = require('node-fetch');
const EikService = require('@eik/service');
const { sink } = require('@eik/core');
const cli = require('../..');
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

function exec(cmd) {
return new Promise((resolve) => {
cp.exec(cmd, (error, stdout, stderr) => {
execCallback(cmd, (error, stdout, stderr) => {
resolve({ error, stdout, stderr });
});
});
Expand All @@ -25,7 +27,10 @@ beforeEach(async (t) => {
const server = fastify({ logger: false });
const service = new EikService({ customSink: memSink });
server.register(service.api());
const address = await server.listen();
const address = await server.listen({
host: '127.0.0.1',
port: 0,
});
const folder = await fs.mkdtemp(join(os.tmpdir(), basename(__filename)));

const token = await cli.login({
Expand Down
31 changes: 18 additions & 13 deletions test/integration/meta.test.js → test/integration/meta.test.mjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
'use strict';
import fastify from 'fastify';
import { promises as fs } from 'fs';
import os from 'os';
import { exec as execCallback } from 'child_process';
import { join, basename } from 'path';
import { test, beforeEach, afterEach } from 'tap';
import EikService from '@eik/service';
import { sink } from '@eik/core';
import cli from '../../classes/index.js';
import { fileURLToPath } from 'url';
import { dirname } from 'path';

/* eslint-disable no-param-reassign */
const fastify = require('fastify');
const fs = require('fs').promises;
const os = require('os');
const cp = require('child_process');
const { join, basename } = require('path');
const { test, beforeEach, afterEach } = require('tap');
const EikService = require('@eik/service');
const { sink } = require('@eik/core');
const cli = require('../..');
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

function exec(cmd) {
return new Promise((resolve) => {
cp.exec(cmd, (error, stdout, stderr) => {
execCallback(cmd, (error, stdout, stderr) => {
resolve({ error, stdout, stderr });
});
});
Expand All @@ -24,7 +26,10 @@ beforeEach(async (t) => {
const server = fastify({ logger: false });
const service = new EikService({ customSink: memSink });
server.register(service.api());
const address = await server.listen();
const address = await server.listen({
host: '127.0.0.1',
port: 0,
});
const folder = await fs.mkdtemp(join(os.tmpdir(), basename(__filename)));
const eik = join(__dirname, '../../index.js');

Expand Down
Loading