Skip to content

Instantly share code, notes, and snippets.

@RafaelGSS
Created October 18, 2023 21:44
Show Gist options
  • Save RafaelGSS/e08193f1328bdbd18ee4d340b6fb9041 to your computer and use it in GitHub Desktop.
Save RafaelGSS/e08193f1328bdbd18ee4d340b6fb9041 to your computer and use it in GitHub Desktop.
diff --git a/package.json b/package.json
index f2277a1..b749b54 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
- "cc": "rimraf ./node_modules/.cache && nyc mocha -r esm test/**/*.spec.js"
+ "cc": "rimraf ./node_modules/.cache && nyc mocha test/**/*.spec.js"
},
"keywords": [],
"author": "",
diff --git a/src/index.js b/src/index.js
index 7d65831..4ae133c 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,3 +1,5 @@
-export function add(a, b) {
- return a + b;
+module.exports = {
+ add: function (a, b) {
+ return a + b;
+ }
}
diff --git a/test/basic.spec.js b/test/basic.spec.js
index c2ea7f6..b29785d 100644
--- a/test/basic.spec.js
+++ b/test/basic.spec.js
@@ -1,5 +1,5 @@
-import { add } from "../src/index";
-import { strict as assert } from 'assert';
+const { add } = require("../src/index");
+const { strict: assert } = require('assert');
describe("basic test", () => {
it("add correctly", () => {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment