Skip to content

Commit e2b3b42

Browse files
Merge branch 'develop' into feat/cy-prompt
2 parents fc4e769 + 4127264 commit e2b3b42

File tree

13 files changed

+145
-13
lines changed

13 files changed

+145
-13
lines changed

.circleci/workflows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2.1
22

3-
chrome-stable-version: &chrome-stable-version "138.0.7204.168"
4-
chrome-beta-version: &chrome-beta-version "139.0.7258.52"
3+
chrome-stable-version: &chrome-stable-version "138.0.7204.183"
4+
chrome-beta-version: &chrome-beta-version "139.0.7258.66"
55
firefox-stable-version: &firefox-stable-version "137.0"
66

77
orbs:

packages/driver/src/cypress.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ class $Cypress {
185185
minimatch = minimatch
186186
sinon = sinon
187187
lolex = fakeTimers
188-
189188
handlePrimaryOriginSocketEvent = handlePrimaryOriginSocketEvent
189+
areSourceMapsAvailable: boolean = false
190190

191191
static $: any
192192
static utils: any
@@ -203,7 +203,7 @@ class $Cypress {
203203
this.primaryOriginCommunicator = new PrimaryOriginCommunicator()
204204
this.specBridgeCommunicator = new SpecBridgeCommunicator()
205205
this.isCrossOriginSpecBridge = false
206-
206+
this.areSourceMapsAvailable = false
207207
this.events = $Events.extend(this)
208208
this.$ = jqueryProxyFn.bind(this)
209209

@@ -380,13 +380,15 @@ class $Cypress {
380380

381381
this.events.proxyTo(this.cy)
382382

383+
this.areSourceMapsAvailable = false
383384
$scriptUtils.runScripts({
384385
browser: this.config('browser'),
385386
scripts,
386387
specWindow,
387388
testingType: this.testingType,
388389
})
389390
.then(() => {
391+
this.areSourceMapsAvailable = $sourceMapUtils.areSourceMapsAvailable()
390392
if (this.testingType === 'e2e') {
391393
return setSpecContentSecurityPolicy(specWindow)
392394
}

packages/driver/src/cypress/source_map_utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,15 @@ const destroySourceMapConsumers = () => {
114114
sourceMapConsumers = {}
115115
}
116116

117+
const areSourceMapsAvailable = () => {
118+
return Object.keys(sourceMapConsumers).length > 0
119+
}
120+
117121
export default {
118122
getSourcePosition,
119123
getSourceContents,
120124
extractSourceMap,
121125
initializeSourceMapConsumer,
122126
destroySourceMapConsumers,
127+
areSourceMapsAvailable,
123128
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
e2e: {
3+
supportFile: false,
4+
setupNodeEvents (on, config) {
5+
require('./cypress-preprocessor.config.js')(on, config)
6+
},
7+
},
8+
env: {
9+
areSourceMapsAvailable: false,
10+
},
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
e2e: {
3+
supportFile: false,
4+
setupNodeEvents (on, config) {
5+
},
6+
},
7+
env: {
8+
areSourceMapsAvailable: true,
9+
},
10+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const webpack = require('@cypress/webpack-preprocessor')
2+
3+
module.exports = (on, config) => {
4+
const options = {
5+
webpackOptions: {
6+
devtool: false, // This disables sourcemaps
7+
resolve: {
8+
extensions: ['.js', '.ts', '.jsx', '.tsx'],
9+
},
10+
module: {
11+
rules: [
12+
{
13+
test: /\.ts$/,
14+
exclude: [/node_modules/],
15+
use: [
16+
{
17+
loader: 'ts-loader',
18+
options: {
19+
transpileOnly: true,
20+
},
21+
},
22+
],
23+
},
24+
],
25+
},
26+
},
27+
watchOptions: {},
28+
}
29+
30+
on('file:preprocessor', webpack(options))
31+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
it('should validate sourcemaps', () => {
2+
expect(Cypress.areSourceMapsAvailable).to.be[Cypress.env('areSourceMapsAvailable')]
3+
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "sourcemaps",
3+
"version": "0.0.0-test",
4+
"devDependencies": {
5+
"@cypress/webpack-preprocessor": "file:../../../npm/webpack-preprocessor"
6+
}
7+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+
5+
"@cypress/webpack-preprocessor@file:../../../npm/webpack-preprocessor":
6+
version "0.0.0-development"
7+
dependencies:
8+
bluebird "3.7.1"
9+
debug "^4.3.4"
10+
lodash "^4.17.20"
11+
semver "^7.3.2"
12+
13+
14+
version "3.7.1"
15+
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.1.tgz#df70e302b471d7473489acf26a93d63b53f874de"
16+
integrity sha512-DdmyoGCleJnkbp3nkbxTLJ18rjDsE4yCggEwKNXkeV123sPNfOCYeDoeuOY+F2FrSjO1YXcTU+dsy96KMy+gcg==
17+
18+
debug@^4.3.4:
19+
version "4.4.1"
20+
resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b"
21+
integrity sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==
22+
dependencies:
23+
ms "^2.1.3"
24+
25+
lodash@^4.17.20:
26+
version "4.17.21"
27+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
28+
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
29+
30+
ms@^2.1.3:
31+
version "2.1.3"
32+
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
33+
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
34+
35+
semver@^7.3.2:
36+
version "7.7.2"
37+
resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58"
38+
integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==

system-tests/test/sourcemaps_spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import systemTests from '../lib/system-tests'
2+
3+
describe('e2e sourcemaps', () => {
4+
systemTests.setup()
5+
6+
systemTests.it('detects sourcemaps as enabled', {
7+
browser: '!webkit',
8+
project: 'sourcemaps',
9+
spec: 'validate-sourcemaps.cy.js',
10+
configFile: 'cypress-enabled.config.js',
11+
})
12+
13+
systemTests.it('detects sourcemaps as disabled', {
14+
browser: '!webkit',
15+
project: 'sourcemaps',
16+
spec: 'validate-sourcemaps.cy.js',
17+
configFile: 'cypress-disabled.config.js',
18+
})
19+
})

0 commit comments

Comments
 (0)