Skip to content

Commit

Permalink
explicitly switch to cjs
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach committed Aug 29, 2024
1 parent 48bae6c commit 1756e68
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"lint": "eslint .",
"lint:fix": "npm run lint -- --fix",
"prepare": "npm run build",
"test": "mocha --exit --timeout 1m \"./test/unit/**/*-specs.js\"",
"test": "mocha --exit --timeout 1m \"./test/unit/**/*-specs.*js\"",
"e2e-test": "mocha --exit --timeout 5m \"./test/e2e/**/*-specs.js\""
},
"prettier": {
Expand Down
22 changes: 5 additions & 17 deletions test/unit/simctl-specs.js → test/unit/simctl-specs.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,24 @@ import sinon from 'sinon';
import * as TeenProcess from 'teen_process';
import _ from 'lodash';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'url';

const proxyquire = pq.noCallThru();
const FILENAME = getFilename();
const DIRNAME = path.dirname(FILENAME);

function getFilename() {
try {
const url = eval('import.meta.url');
return fileURLToPath(url);
} catch (e) {
return __filename;
}
}

const devicePayloads = [
[
{
stdout: fs.readFileSync(`${DIRNAME}/fixtures/devices.json`, 'utf-8'),
stdout: fs.readFileSync(`${__dirname}/fixtures/devices.json`, 'utf-8'),
},
{
stdout: fs.readFileSync(`${DIRNAME}/fixtures/devices-with-unavailable.json`, 'utf-8'),
stdout: fs.readFileSync(`${__dirname}/fixtures/devices-with-unavailable.json`, 'utf-8'),
},
],
[
{
stdout: fs.readFileSync(`${DIRNAME}/fixtures/devices-simple.json`, 'utf-8'),
stdout: fs.readFileSync(`${__dirname}/fixtures/devices-simple.json`, 'utf-8'),
},
{
stdout: fs.readFileSync(`${DIRNAME}/fixtures/devices-with-unavailable-simple.json`, 'utf-8'),
stdout: fs.readFileSync(`${__dirname}/fixtures/devices-with-unavailable-simple.json`, 'utf-8'),
},
],
];
Expand All @@ -60,6 +47,7 @@ describe('simctl', function () {
chai.use(chaiAsPromised.default);
});


describe('getDevices', function () {
let simctl;

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@appium/tsconfig/tsconfig.json",
"compilerOptions": {
"strict": false, // TODO: make this flag true
"strict": false,
"esModuleInterop": true,
"outDir": "build",
"types": ["node"],
"checkJs": true
Expand Down

0 comments on commit 1756e68

Please sign in to comment.