From 67b0bb2cfceb3f04fcd25a09222e86404805c594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=A8=E3=83=AA=E3=82=B9?= Date: Mon, 6 Dec 2021 10:57:40 +0900 Subject: [PATCH] dep: bump jasmine@^3.10.0 (#1208) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * dep: bump jasmine@^3.10.0 * test(prepare): fix error from jasmine bump * fix: do not provide arrow fns as fake ctors Co-authored-by: Raphael von der GrĂ¼n --- package-lock.json | 34 ++++++++++++++++----------------- package.json | 2 +- tests/spec/unit/Api.spec.js | 14 +++++++------- tests/spec/unit/prepare.spec.js | 23 ++++++++-------------- 4 files changed, 33 insertions(+), 40 deletions(-) diff --git a/package-lock.json b/package-lock.json index db30c951d..e71ede778 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "devDependencies": { "@cordova/eslint-config": "^4.0.0", "cordova-js": "^6.1.0", - "jasmine": "3.5.0", + "jasmine": "^3.10.0", "nyc": "^15.1.0", "rewire": "^5.0.0", "tmp": "^0.2.1" @@ -2911,22 +2911,22 @@ } }, "node_modules/jasmine": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.5.0.tgz", - "integrity": "sha512-DYypSryORqzsGoMazemIHUfMkXM7I7easFaxAvNM3Mr6Xz3Fy36TupTrAOxZWN8MVKEU5xECv22J4tUQf3uBzQ==", + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.10.0.tgz", + "integrity": "sha512-2Y42VsC+3CQCTzTwJezOvji4qLORmKIE0kwowWC+934Krn6ZXNQYljiwK5st9V3PVx96BSiDYXSB60VVah3IlQ==", "dev": true, "dependencies": { - "glob": "^7.1.4", - "jasmine-core": "~3.5.0" + "glob": "^7.1.6", + "jasmine-core": "~3.10.0" }, "bin": { "jasmine": "bin/jasmine.js" } }, "node_modules/jasmine-core": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.5.0.tgz", - "integrity": "sha512-nCeAiw37MIMA9w9IXso7bRaLl+c/ef3wnxsoSAlYrzS+Ot0zTG6nU8G/cIfGkqpkjX2wNaIW9RFG0TwIFnG6bA==", + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.10.1.tgz", + "integrity": "sha512-ooZWSDVAdh79Rrj4/nnfklL3NQVra0BcuhcuWoAwwi+znLDoUeH87AFfeX8s+YeYi6xlv5nveRyaA1v7CintfA==", "dev": true }, "node_modules/js-tokens": { @@ -7211,19 +7211,19 @@ } }, "jasmine": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.5.0.tgz", - "integrity": "sha512-DYypSryORqzsGoMazemIHUfMkXM7I7easFaxAvNM3Mr6Xz3Fy36TupTrAOxZWN8MVKEU5xECv22J4tUQf3uBzQ==", + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.10.0.tgz", + "integrity": "sha512-2Y42VsC+3CQCTzTwJezOvji4qLORmKIE0kwowWC+934Krn6ZXNQYljiwK5st9V3PVx96BSiDYXSB60VVah3IlQ==", "dev": true, "requires": { - "glob": "^7.1.4", - "jasmine-core": "~3.5.0" + "glob": "^7.1.6", + "jasmine-core": "~3.10.0" } }, "jasmine-core": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.5.0.tgz", - "integrity": "sha512-nCeAiw37MIMA9w9IXso7bRaLl+c/ef3wnxsoSAlYrzS+Ot0zTG6nU8G/cIfGkqpkjX2wNaIW9RFG0TwIFnG6bA==", + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.10.1.tgz", + "integrity": "sha512-ooZWSDVAdh79Rrj4/nnfklL3NQVra0BcuhcuWoAwwi+znLDoUeH87AFfeX8s+YeYi6xlv5nveRyaA1v7CintfA==", "dev": true }, "js-tokens": { diff --git a/package.json b/package.json index 215ec9070..fa5a45efa 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "devDependencies": { "@cordova/eslint-config": "^4.0.0", "cordova-js": "^6.1.0", - "jasmine": "3.5.0", + "jasmine": "^3.10.0", "nyc": "^15.1.0", "rewire": "^5.0.0", "tmp": "^0.2.1" diff --git a/tests/spec/unit/Api.spec.js b/tests/spec/unit/Api.spec.js index 290211976..269e9053d 100644 --- a/tests/spec/unit/Api.spec.js +++ b/tests/spec/unit/Api.spec.js @@ -123,7 +123,7 @@ describe('Platform Api', () => { bridgingHeader_mock = jasmine.createSpyObj('bridgingHeader mock', ['addHeader', 'write']); spyOn(my_plugin, 'getFrameworks').and.returnValue([]); spyOn(my_plugin, 'getHeaderFiles').and.returnValue([my_bridgingHeader_json]); - BridgingHeader_mod.BridgingHeader.and.callFake(() => bridgingHeader_mock); + BridgingHeader_mod.BridgingHeader.and.returnValue(bridgingHeader_mock); }); it('should add BridgingHeader', () => { return api.addPlugin(my_plugin) @@ -169,8 +169,8 @@ describe('Platform Api', () => { podfile_mock = jasmine.createSpyObj('podfile mock', ['isDirty', 'addSpec', 'addSource', 'addDeclaration', 'write', 'install']); spyOn(my_plugin, 'getFrameworks').and.returnValue([]); spyOn(my_plugin, 'getPodSpecs').and.returnValue([my_pod_json]); - PodsJson_mod.PodsJson.and.callFake(() => podsjson_mock); - Podfile_mod.Podfile.and.callFake(() => podfile_mock); + PodsJson_mod.PodsJson.and.returnValue(podsjson_mock); + Podfile_mod.Podfile.and.returnValue(podfile_mock); }); it('on a new declaration, it should add a new json to declarations', () => { return api.addPlugin(my_plugin) @@ -298,8 +298,8 @@ describe('Platform Api', () => { podsjson_mock = jasmine.createSpyObj('podsjson mock', ['getLibrary', 'incrementLibrary', 'write', 'setJsonLibrary']); podfile_mock = jasmine.createSpyObj('podfile mock', ['isDirty', 'addSpec', 'write', 'install']); spyOn(my_plugin, 'getFrameworks').and.returnValue([my_pod_json]); - PodsJson_mod.PodsJson.and.callFake(() => podsjson_mock); - Podfile_mod.Podfile.and.callFake(() => podfile_mock); + PodsJson_mod.PodsJson.and.returnValue(podsjson_mock); + Podfile_mod.Podfile.and.returnValue(podfile_mock); }); // TODO: a little help with clearly labeling / describing the tests below? :( it('should warn if Pods JSON contains name/src but differs in spec', () => { @@ -400,8 +400,8 @@ describe('Platform Api', () => { podfile_mock = jasmine.createSpyObj('podfile mock', ['isDirty', 'removeSpec', 'removeSource', 'removeDeclaration', 'write', 'install']); spyOn(my_plugin, 'getFrameworks').and.returnValue([]); spyOn(my_plugin, 'getPodSpecs').and.returnValue([my_pod_json]); - PodsJson_mod.PodsJson.and.callFake(() => podsjson_mock); - Podfile_mod.Podfile.and.callFake(() => podfile_mock); + PodsJson_mod.PodsJson.and.returnValue(podsjson_mock); + Podfile_mod.Podfile.and.returnValue(podfile_mock); }); it('on a last declaration, it should remove a json from declarations', () => { const json1 = { declaration: 'use_frameworks!', count: 1 }; diff --git a/tests/spec/unit/prepare.spec.js b/tests/spec/unit/prepare.spec.js index ce165defc..b51a9f6da 100644 --- a/tests/spec/unit/prepare.spec.js +++ b/tests/spec/unit/prepare.spec.js @@ -24,6 +24,7 @@ const EventEmitter = require('events'); const path = require('path'); const plist = require('plist'); const xcode = require('xcode'); +const XcodeProject = xcode.project; const rewire = require('rewire'); const prepare = rewire('../../../lib/prepare'); const projectFile = require('../../../lib/projectFile'); @@ -558,8 +559,6 @@ describe('prepare', () => { describe('updateProject method', () => { /* eslint-disable no-unused-vars */ let update_name; - /* eslint-enable no-unused-vars */ - const xcOrig = xcode.project; let writeFileSyncSpy; let cfg; let cfg2; @@ -578,7 +577,7 @@ describe('prepare', () => { spyOn(plist, 'parse').and.returnValue({}); spyOn(plist, 'build').and.returnValue(''); spyOn(xcode, 'project').and.callFake(pbxproj => { - const xc = new xcOrig(pbxproj); /* eslint new-cap : 0 */ + const xc = new XcodeProject(pbxproj); update_name = spyOn(xc, 'updateProductName').and.callThrough(); return xc; }); @@ -609,8 +608,7 @@ describe('prepare', () => { writeFileSyncSpy.and.callThrough(); return updateProject(cfg2, p.locations).then(() => { - const xcode = require('xcode'); - const proj = new xcode.project(p.locations.pbxproj); /* eslint new-cap : 0 */ + const proj = new XcodeProject(p.locations.pbxproj); proj.parseSync(); const prop = proj.getBuildProperty('TARGETED_DEVICE_FAMILY'); expect(prop).toEqual('"1"'); // 1 is handset @@ -621,8 +619,7 @@ describe('prepare', () => { writeFileSyncSpy.and.callThrough(); return updateProject(cfg2, p.locations).then(() => { - const xcode = require('xcode'); - const proj = new xcode.project(p.locations.pbxproj); /* eslint new-cap : 0 */ + const proj = new XcodeProject(p.locations.pbxproj); proj.parseSync(); const prop = proj.getBuildProperty('IPHONEOS_DEPLOYMENT_TARGET'); expect(prop).toEqual('11.0'); @@ -632,8 +629,7 @@ describe('prepare', () => { cfg3.name = () => 'SampleApp'; // new config does *not* have a name change writeFileSyncSpy.and.callThrough(); return updateProject(cfg3, p.locations).then(() => { - const xcode = require('xcode'); - const proj = new xcode.project(p.locations.pbxproj); /* eslint new-cap : 0 */ + const proj = new XcodeProject(p.locations.pbxproj); proj.parseSync(); const prop = proj.getBuildProperty('SWIFT_VERSION'); expect(prop).toEqual('4.1'); @@ -646,8 +642,7 @@ describe('prepare', () => { pref.attrib.value = '3.3'; writeFileSyncSpy.and.callThrough(); return updateProject(cfg3, p.locations).then(() => { - const xcode = require('xcode'); - const proj = new xcode.project(p.locations.pbxproj); /* eslint new-cap : 0 */ + const proj = new XcodeProject(p.locations.pbxproj); proj.parseSync(); const prop = proj.getBuildProperty('SWIFT_VERSION'); expect(prop).toEqual('3.3'); @@ -665,8 +660,7 @@ describe('prepare', () => { writeFileSyncSpy.and.callThrough(); return updateProject(cfg, p.locations).then(() => { - const xcode = require('xcode'); - const proj = new xcode.project(p.locations.pbxproj); /* eslint new-cap : 0 */ + const proj = new XcodeProject(p.locations.pbxproj); proj.parseSync(); const prop = proj.getBuildProperty('PRODUCT_BUNDLE_IDENTIFIER', undefined, 'SampleApp'); expect(prop).toEqual('testpkg'); @@ -684,8 +678,7 @@ describe('prepare', () => { writeFileSyncSpy.and.callThrough(); return updateProject(cfg, p.locations).then(() => { - const xcode = require('xcode'); - const proj = new xcode.project(p.locations.pbxproj); /* eslint new-cap : 0 */ + const proj = new XcodeProject(p.locations.pbxproj); proj.parseSync(); const prop = proj.getBuildProperty('PRODUCT_BUNDLE_IDENTIFIER', undefined, 'SampleApp'); expect(prop).toEqual('testpkg_ios');