Skip to content

Commit

Permalink
dep: bump jasmine@^3.10.0 (#1208)
Browse files Browse the repository at this point in the history
* 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 <raphinesse@gmail.com>
  • Loading branch information
erisu and raphinesse committed Dec 6, 2021
1 parent 8474a3c commit 67b0bb2
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 40 deletions.
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 7 additions & 7 deletions tests/spec/unit/Api.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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 };
Expand Down
23 changes: 8 additions & 15 deletions tests/spec/unit/prepare.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
Expand All @@ -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;
});
Expand Down Expand Up @@ -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
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand Down

0 comments on commit 67b0bb2

Please sign in to comment.