Skip to content

Commit

Permalink
Upgrade grunt-contrib-jasmine to v4, grunt-template-jasmine-istanbul …
Browse files Browse the repository at this point in the history
…to v0.6

In order to a) remove a critical code injection vulnerability and b) upgrade browser tests to a recent version of Headless Chrome (instead of PhantomJS), this upgrades grunt-contrib-jasmine to v4.0.0 and grunt-template-jasmine-istanbul to v0.6.0 (via git; this version was never published on NPM). Upgrading the former requires upgrading the latter.

Important notes:

1. This is a little iffy, in that this version of grunt-template-jasmine-istanbul was never published to NPM, supposedly on account of it causing some test failures (unclear whether those failures are problems with the code or with the tests): maenu/grunt-template-jasmine-istanbul#64 (comment)

2. This requires installation via `npm install --legacy-peer-deps` because this version of grunt-template-jasmine-istanbul has a peer dependency on grunt-contrib-jasmine v2.x, but we are now on v4.x. It still works fine, but is a little messy to require this extra flag (this should only affect installs that include dev dependencies, not people who are installing loglevel as a dependency of their project).

The best solution to these is probably to drop grunt-template-jasmine-istanbul altogether -- we aren't really using the coverage information it gathers right now. The next alternative is to fork and vendor it like we did for grunt-template-jasmine-requirejs.
  • Loading branch information
Mr0grog committed Jan 17, 2024
1 parent 1e6bdba commit c73f8a0
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 45 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
cache-dependency-path: 'package.json'

- name: Install dependencies
run: npm install
run: npm install --legacy-peer-deps

- name: JSHint
run: npm run lint
Expand All @@ -42,7 +42,7 @@ jobs:
cache-dependency-path: 'package.json'

- name: Install dependencies
run: npm install
run: npm install --legacy-peer-deps

- name: Build
run: npm run dist-build
Expand All @@ -64,7 +64,7 @@ jobs:
cache-dependency-path: 'package.json'

- name: Install dependencies
run: npm install
run: npm install --legacy-peer-deps

- name: Unit Tests
run: npm run test-node
Expand All @@ -83,7 +83,7 @@ jobs:
cache-dependency-path: 'package.json'

- name: Install dependencies
run: npm install
run: npm install --legacy-peer-deps

- name: Unit Tests
run: npm run test-browser
Expand All @@ -102,7 +102,7 @@ jobs:
cache-dependency-path: 'package.json'

- name: Install dependencies
run: npm install
run: npm install --legacy-peer-deps

- name: Typescript Tests
run: npm run test-types
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
"grunt-contrib-clean": "^1.1.0",
"grunt-contrib-concat": "~0.5.0",
"grunt-contrib-connect": "^1.0.2",
"grunt-contrib-jasmine": "^1.2.0",
"grunt-contrib-jasmine": "^4.0.0",
"grunt-contrib-jshint": "^1.1.0",
"grunt-contrib-uglify": "^3.4.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-open": "~0.2.3",
"grunt-preprocess": "^5.1.0",
"grunt-template-jasmine-istanbul": "~0.4.0",
"grunt-template-jasmine-istanbul": "https://github.com/maenu/grunt-template-jasmine-istanbul.git#caedc636b9f9c11217a32d586717e3153edf9ba3",
"jasmine": "^2.4.1",
"typescript": "^3.5.1"
},
Expand Down
6 changes: 0 additions & 6 deletions test/console-fallback-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ define(['../lib/loglevel', 'test/test-helpers'], function(log, testHelpers) {
var originalConsole = window.console;

describe("Fallback functionality:", function() {
beforeEach(function() {
jasmine.addMatchers({
nothing: testHelpers.nothing
});
});

describe("with no console present", function() {
beforeEach(function() {
window.console = undefined;
Expand Down
13 changes: 0 additions & 13 deletions test/global-integration-with-new-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,6 @@
"use strict";

describe("loglevel from a global <script> tag with a custom context", function () {
beforeEach(function () {
jasmine.addMatchers({
// Polyfill for expect().nothing() in Jasmine 2.8+.
nothing: function nothing() {
return {
compare: function() {
return { pass: true };
}
};
}
});
});

it("is available globally", function () {
expect(MyCustomLogger).not.toBeUndefined();
});
Expand Down
12 changes: 0 additions & 12 deletions test/global-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@
"use strict";

describe("loglevel from a global <script> tag", function () {
beforeEach(function () {
jasmine.addMatchers({
// Polyfill for expect().nothing() in Jasmine 2.8+.
nothing: function nothing() {
return {
compare: function() {
return { pass: true };
}
};
}
});
});

it("is available globally", function () {
expect(log).not.toBeUndefined();
Expand Down
6 changes: 0 additions & 6 deletions test/integration-smoke-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ define(['../lib/loglevel', 'test/test-helpers'], function(log, testHelpers) {
var itIf = testHelpers.itIf;

describe("Integration smoke tests:", function() {
beforeEach(function() {
jasmine.addMatchers({
"nothing": testHelpers.nothing
});
});

describe("log methods", function() {
it("can all be disabled", function() {
log.setLevel(log.levels.SILENT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
<script src="<%= temp ? temp + "/" : temp %>require.js"></script>

<% with (scripts) { %>
<% [].concat(jasmine, boot, helpers).forEach(function(script){ %>
<% /* LOGLEVEL-FORK: Include new script types used by grunt-contrib-jasmine v4 */ %>
<% [].concat(polyfills, jasmine, boot, boot2, helpers).forEach(function(script){ %>
<script src="<%= script %>"></script>
<% }) %>
<% /* END LOGLEVEL-FORK */ %>
<% }; %>

<script>
Expand Down

0 comments on commit c73f8a0

Please sign in to comment.