Skip to content

Commit

Permalink
Merge pull request #190 from Mr0grog/update-dev-deps-without-updating…
Browse files Browse the repository at this point in the history
…-node

Update dev deps to make tests work on MacOS and resolve Critical arbitrary code execution/command injection vulnerabilities
  • Loading branch information
pimterry authored Jan 10, 2024
2 parents f018721 + 5f3764e commit 771e259
Show file tree
Hide file tree
Showing 60 changed files with 8,392 additions and 76 deletions.
4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = function (grunt) {
specs: 'test/*-test.js',
vendor: 'test/vendor/*.js',
helpers: 'test/*-helper.js',
template: require('grunt-template-jasmine-requirejs')
template: require('./vendor/grunt-template-jasmine-requirejs')
}
},
global: {
Expand Down Expand Up @@ -78,7 +78,7 @@ module.exports = function (grunt) {
}
],

template: require('grunt-template-jasmine-requirejs'),
template: require('./vendor/grunt-template-jasmine-requirejs'),
templateOptions: {
requireConfig: {
paths: {
Expand Down
21 changes: 10 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,22 @@
"devDependencies": {
"@types/core-js": "2.5.0",
"@types/node": "^12.0.4",
"grunt": "~0.4.5",
"grunt-cli": "~0.1.13",
"grunt-contrib-clean": "^0.6.0",
"grunt": "~1.0.4",
"grunt-cli": "~1.2.0",
"grunt-contrib-clean": "^1.1.0",
"grunt-contrib-concat": "~0.5.0",
"grunt-contrib-connect": "~0.8.0",
"grunt-contrib-jasmine": "~0.5.2",
"grunt-contrib-connect": "^1.0.2",
"grunt-contrib-jasmine": "~1.0.3",
"grunt-contrib-jshint": "^1.1.0",
"grunt-contrib-qunit": "~0.5.2",
"grunt-contrib-uglify": "~0.5.1",
"grunt-contrib-watch": "~0.6.1",
"grunt-contrib-qunit": "^2.0.0",
"grunt-contrib-uglify": "^3.4.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-coveralls": "^1.0.0",
"grunt-jasmine-node": "~0.2.1",
"grunt-open": "~0.2.3",
"grunt-preprocess": "^4.0.0",
"grunt-preprocess": "^5.1.0",
"grunt-saucelabs": "^8.2.0",
"grunt-template-jasmine-istanbul": "~0.2.5",
"grunt-template-jasmine-requirejs": "~0.1.6",
"grunt-template-jasmine-istanbul": "~0.4.0",
"qunitjs": "1.14.0",
"typescript": "^3.5.1"
},
Expand Down
7 changes: 5 additions & 2 deletions test/console-fallback-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ function consoleLogIsCalledBy(log, methodName) {
it(methodName + " calls console.log", function() {
log.setLevel(log.levels.TRACE);
log[methodName]("Log message for call to " + methodName);
expect(console.log.calls.length).toEqual(1);
expect(console.log.calls.count()).toEqual(1);
});
}

function mockConsole() {
return {"log" : jasmine.createSpy("console.log")};
}

define(['../lib/loglevel'], function(log) {
define(['../lib/loglevel', 'test/test-helpers'], function(log, testHelpers) {
var originalConsole = window.console;

describe("Fallback functionality:", function() {
Expand Down Expand Up @@ -40,6 +40,7 @@ define(['../lib/loglevel'], function(log) {
it("active method calls are allowed, once the active setLevel fails", function() {
log.setLevel(log.levels.TRACE);
log.trace("hello");
expect().nothing();
});

describe("if a console later appears", function () {
Expand Down Expand Up @@ -81,10 +82,12 @@ define(['../lib/loglevel'], function(log) {

it("log can be set to silent", function() {
log.setLevel(log.levels.SILENT);
expect().nothing();
});

it("log can be set to an active level", function() {
log.setLevel(log.levels.ERROR);
expect().nothing();
});

consoleLogIsCalledBy(log, "trace");
Expand Down
2 changes: 1 addition & 1 deletion test/cookie-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ define(['test/test-helpers'], function(testHelpers) {

beforeEach(function() {
window.console = {"log" : jasmine.createSpy("console.log")};
this.addMatchers({
jasmine.addMatchers({
"toBeAtLevel" : testHelpers.toBeAtLevel,
"toBeTheStoredLevel" : testHelpers.toBeTheLevelStoredByCookie
});
Expand Down
6 changes: 3 additions & 3 deletions test/default-level-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ define(['test/test-helpers'], function(testHelpers) {

beforeEach(function() {
window.console = {"log" : jasmine.createSpy("console.log")};
this.addMatchers({
jasmine.addMatchers({
"toBeAtLevel" : testHelpers.toBeAtLevel,
"toBeTheStoredLevel" : testHelpers.toBeTheLevelStoredByLocalStorage
});
Expand All @@ -33,12 +33,12 @@ define(['test/test-helpers'], function(testHelpers) {
expect("debug").not.toBeTheStoredLevel();
});
});

describe("If a level is saved", function () {
beforeEach(function () {
testHelpers.setStoredLevel("trace");
});

it("saved level is not modified", function (log) {
log.setDefaultLevel("debug");
expect(log).toBeAtLevel("trace");
Expand Down
1 change: 1 addition & 0 deletions test/global-integration-with-new-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe("loglevel from a global <script> tag with a custom context", function (
MyCustomLogger.setLevel(MyCustomLogger.levels.INFO);
MyCustomLogger.setLevel(MyCustomLogger.levels.WARN);
MyCustomLogger.setLevel(MyCustomLogger.levels.ERROR);
expect().nothing();
});

it("successfully logs", function () {
Expand Down
3 changes: 2 additions & 1 deletion test/global-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe("loglevel from a global <script> tag", function () {
log.setLevel(log.levels.INFO);
log.setLevel(log.levels.WARN);
log.setLevel(log.levels.ERROR);
expect().nothing();
});

it("successfully logs", function () {
Expand All @@ -22,4 +23,4 @@ describe("loglevel from a global <script> tag", function () {

expect(console.log).toHaveBeenCalledWith("test message");
});
});
});
10 changes: 5 additions & 5 deletions test/integration-smoke-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,26 @@ define(['../lib/loglevel', 'test/test-helpers'], function(log, testHelpers) {
log.info("info");
log.warn("warn");
log.error("error");
expect().nothing();
});
});

describeIf(typeof console !== "undefined", "log methods", function() {
it("can all be called", function() {
if (typeof console !== "undefined") {
log.setLevel(log.levels.TRACE);
}

log.setLevel(log.levels.TRACE);
log.trace("trace");
log.debug("debug");
log.log("log");
log.info("info");
log.warn("warn");
log.error("error");
expect().nothing();
});
});

describeIf(typeof console !== "undefined", "log levels", function() {
beforeEach(function() {
this.addMatchers({
jasmine.addMatchers({
"toBeTheStoredLevel" : testHelpers.toBeTheStoredLevel
});
});
Expand All @@ -45,6 +44,7 @@ define(['../lib/loglevel', 'test/test-helpers'], function(log, testHelpers) {
log.setLevel(log.levels.INFO);
log.setLevel(log.levels.WARN);
log.setLevel(log.levels.ERROR);
expect().nothing();
});

itIf(testHelpers.isAnyLevelStoragePossible(), "are persisted", function() {
Expand Down
8 changes: 4 additions & 4 deletions test/local-storage-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ define(['test/test-helpers'], function(testHelpers) {

beforeEach(function() {
window.console = {"log" : jasmine.createSpy("console.log")};
this.addMatchers({
jasmine.addMatchers({
"toBeAtLevel" : testHelpers.toBeAtLevel,
"toBeTheStoredLevel" : testHelpers.toBeTheLevelStoredByLocalStorage,
"toBeTheLevelStoredByLocalStorage": testHelpers.toBeTheLevelStoredByLocalStorage,
Expand Down Expand Up @@ -48,12 +48,12 @@ define(['test/test-helpers'], function(testHelpers) {
expect("debug").not.toBeTheStoredLevel();
});
});

describe("If trace level is saved", function () {
beforeEach(function () {
testHelpers.setStoredLevel("trace");
});

it("trace is the default log level", function (log) {
expect(log).toBeAtLevel("trace");
});
Expand All @@ -68,7 +68,7 @@ define(['test/test-helpers'], function(testHelpers) {
expect(log).toBeAtLevel("debug");
});
});

describe("If info level is saved", function() {
beforeEach(function() {
testHelpers.setStoredLevel("info");
Expand Down
18 changes: 9 additions & 9 deletions test/method-factory-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ define(['test/test-helpers'], function(testHelpers) {
log.methodFactory = jasmine.createSpy("methodFactory");

log.setLevel("trace");
expect(log.methodFactory.calls.length).toEqual(5);
expect(log.methodFactory.argsForCall[0]).toEqual(["trace", 0, undefined]);
expect(log.methodFactory.argsForCall[1]).toEqual(["debug", 0, undefined]);
expect(log.methodFactory.argsForCall[2]).toEqual(["info", 0, undefined]);
expect(log.methodFactory.argsForCall[3]).toEqual(["warn", 0, undefined]);
expect(log.methodFactory.argsForCall[4]).toEqual(["error", 0, undefined]);
expect(log.methodFactory.calls.count()).toEqual(5);
expect(log.methodFactory.calls.argsFor(0)).toEqual(["trace", 0, undefined]);
expect(log.methodFactory.calls.argsFor(1)).toEqual(["debug", 0, undefined]);
expect(log.methodFactory.calls.argsFor(2)).toEqual(["info", 0, undefined]);
expect(log.methodFactory.calls.argsFor(3)).toEqual(["warn", 0, undefined]);
expect(log.methodFactory.calls.argsFor(4)).toEqual(["error", 0, undefined]);

log.setLevel("error");
expect(log.methodFactory.calls.length).toEqual(6);
expect(log.methodFactory.argsForCall[5]).toEqual(["error", 4, undefined]);
expect(log.methodFactory.calls.count()).toEqual(6);
expect(log.methodFactory.calls.argsFor(5)).toEqual(["error", 4, undefined]);
});

it("functions returned by methodFactory should be used as logging functions", function(log) {
Expand All @@ -35,7 +35,7 @@ define(['test/test-helpers'], function(testHelpers) {
logger.methodFactory = jasmine.createSpy("methodFactory");

logger.setLevel("error");
expect(logger.methodFactory.argsForCall[0]).toEqual(["error", 4, "newLogger"]);
expect(logger.methodFactory.calls.argsFor(0)).toEqual(["error", 4, "newLogger"]);
});

});
Expand Down
2 changes: 1 addition & 1 deletion test/multiple-logger-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ define(['test/test-helpers'], function(testHelpers) {
describe("inheritance", function() {
beforeEach(function() {
window.console = {"log" : jasmine.createSpy("console.log")};
this.addMatchers({
jasmine.addMatchers({
"toBeAtLevel" : testHelpers.toBeAtLevel
});
testHelpers.clearStoredLevels();
Expand Down
Loading

0 comments on commit 771e259

Please sign in to comment.