From 93c891c1465c1677362691bf71324988a458bdf4 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Thu, 17 May 2018 01:19:32 +0530 Subject: [PATCH] [npm] New scripts! --- package.json | 9 +++++---- spec/spec.js | 11 ++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index d00f775..47c5dac 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,11 @@ "description": "Infinitely generating linked list with memoisation (or an n-generator)", "main": "es5/infinity.min.js", "scripts": { - "test": "jasmine", - "build": "./build.sh && jasmine", - "prepublishOnly": "npm run build", - "release": "npm run build && npm publish" + "build": "./build.sh", + "test:es6": "NODE_ENV=development jasmine", + "test:es5": "NODE_ENV=production npm run build && jasmine", + "test": "npm run test:es6 && npm run test:es5", + "prepublishOnly": "npm test" }, "keywords": [ "infinite", diff --git a/spec/spec.js b/spec/spec.js index 8e2a1f3..650d43d 100644 --- a/spec/spec.js +++ b/spec/spec.js @@ -1,10 +1,11 @@ 'use strict'; -const InfiniteList = require('../es6'); +const path = '..' + (process.env.NODE_ENV === 'development' ? '/es6' : '/es5/infinity.min.js'); -const { - InfiniteListItem -} = require('..'); +const InfiniteList = require(path); +const { InfiniteListItem } = require(path); + +console.log(`\nTesting ${path}\n`); String.prototype.trimify = function() { return this.replace(/\s/g, ''); @@ -40,7 +41,7 @@ describe("InfiniteList", () => { it("Should be true", () => { const Infinite = new InfiniteList(0, x => x + 2); - expect((Infinite.get(5)) instanceof InfiniteListItem).toBe(true); + expect(Infinite.get(5) instanceof InfiniteListItem).toBe(true); }); it("Should be 22", () => {