Skip to content

Commit 434b20d

Browse files
committed
Test cases using esm and code coverage fix
1 parent b2ddb5f commit 434b20d

File tree

6 files changed

+11
-6
lines changed

6 files changed

+11
-6
lines changed

.github/workflows/nodejs.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ jobs:
1515
- uses: actions/checkout@v1
1616
- name: Use Node.js ${{ matrix.node-version }}
1717
uses: actions/setup-node@v1
18-
uses: codecov/codecov-action@v1
1918
with:
2019
node-version: ${{ matrix.node-version }}
2120
- name: build and test
2221
run: |
2322
npm install
24-
npm run build
2523
npm run test
2624
npm run report-coverage
2725
env:

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@rollup/plugin-node-resolve": "^8.4.0",
2121
"chai": "^4.2.0",
2222
"codecov": "^3.8.0",
23+
"esm": "^3.2.25",
2324
"formdata-node": "2.1.0",
2425
"mocha": "^7.0.1",
2526
"nyc": "^15.1.0",
@@ -30,7 +31,7 @@
3031
"scripts": {
3132
"dev": "rollup -c -w",
3233
"build": "rm -rf dist*;rollup -c",
33-
"test": "export NODE_ENV=test && nyc ./node_modules/mocha/bin/mocha --exit -t 40000 test/*.js;ex=$? ; unset NODE_ENV ; exit $ex;",
34+
"test": "export NODE_ENV=test && nyc ./node_modules/mocha/bin/mocha -r esm --exit -t 40000 test/*.js;ex=$? ; unset NODE_ENV ; exit $ex;",
3435
"startSampleApp": "yarn build && cd samples/sample-app/ && yarn install && node index.js",
3536
"report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov"
3637
},

test/initialization.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const chai = require("chai");
22
const expect = chai.expect;
33
const initializationParams = require("./data").initializationParams
4-
const ImageKit = require(".."); // This will automatically pick main module (cjs bundle) as per package.json
4+
import ImageKit from "../src/index.js";
55

66

77
describe("Initialization checks", function () {

test/upload.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const sinon = require("sinon");
33
global.FormData = require('formdata-node');
44
const expect = chai.expect;
55
const initializationParams = require("./data").initializationParams
6-
const ImageKit = require(".."); // This will automatically pick main module (cjs bundle) as per package.json
6+
import ImageKit from "../src/index.js";
77
var requests, server;
88

99
const uploadSuccessResponseObj = {

test/url-generation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const pkg = require("../package.json");
33
global.FormData = require('formdata-node');
44
const expect = chai.expect;
55
const initializationParams = require("./data").initializationParams
6-
const ImageKit = require(".."); // This will automatically pick main module (cjs bundle) as per package.json
6+
import ImageKit from "../src/index.js";
77

88
describe("URL generation", function () {
99

0 commit comments

Comments
 (0)