mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-06 15:20:25 -06:00
* fix broken menu specs * extract browserify code and create preprocessor abstraction * server: remove unused code * server: implement logic for importing preprocessor * server: add eslintrc and ignore test fixtures * server: implement plugins API * server: add node_cache module to manage clearing a package and its dependencies * server: clear plugins file from cache to re-require it * server: set pluginsFile to absolute path * server: add debug logging to plugins * server: watch pluginsFile * server: throw the right error when requiring plugins file * server: organize config folders and keys visually * server: scaffold plugins file * server: require plugins file via nodeCache.require * server: update browserify preprocessor name and point to github for now * server: remove redundant integration tests * server: always scaffold plugins file, except when falsey * server: add plugins file test to scaffold spec * server: always provide util.fileUpdated to preprocessor * server: update browserify-preprocessor dep * server: fix integration tests * server: remove redundant logic * server: catch errors thrown synchronously by plugins function * server: reduce chances of flakyness in async test * driver: fix broken spec * server: don’t check for dirname of supportFile and pluginFile when we know they’re already a directory * driver: there is no dist * server: update default options sent to browserify preprocessor * server: send config into browserify instead of options * server: add test around default preprocessor * server: update browserify preprocessor * server: refactor events spec to better handle multiple calls to handleEvent * server: add tests around project:open events * server/desktop-gui: handle errors when plugins file changes * server: fix events spec * server: allow any file types to be spec files * server: validate config.pluginsFile * server: remove link to error doc * server: improve plugins error message * server: simplify example plugins file * server: on:spec:file:preprocessor -> file:preprocessor * server: wrap plugins in a child process * server: rename specsGlob to testFiles * server: bump browserify-preprocessor ‘version’ * server: fix references left by merge * server: fix incorrect function names * server: fix plugin error serialization * server: display error if plugins process has an uncaught exception or unhandled rejection * server: reset domain on reset * server: exit early on plugin error headlessly * server: add e2e tests for plugins/preprocessors * server: remove obselete node cache file * server: fix integration tests * server: log plugins error before exiting * server: use npm version of browserify preprocessor * server: extract string-splitting function * socket: use path.join in spec * server: eslint ignore scaffold files * server: fix scaffolded plugins file links, add snapshot test * server: if app_spec runs, cause a failure [skip ci] - tested locally
50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
/* global describe, it, context */
|
|
|
|
const fs = require('fs')
|
|
const path = require('path')
|
|
const server = require('socket.io')
|
|
const client = require('socket.io-client')
|
|
const expect = require('chai').expect
|
|
const pkg = require('../package.json')
|
|
const lib = require('../index')
|
|
|
|
describe('Socket', function () {
|
|
it('exports server', function () {
|
|
expect(lib.server).to.eq(server)
|
|
})
|
|
|
|
it('exports client', function () {
|
|
expect(lib.client).to.eq(client)
|
|
})
|
|
|
|
context('.getPathToClientSource', function () {
|
|
it('returns path to socket.io.js', function () {
|
|
const clientPath = path.join(process.cwd(), 'node_modules', 'socket.io-client', 'dist', 'socket.io.js')
|
|
expect(lib.getPathToClientSource()).to.eq(clientPath)
|
|
})
|
|
|
|
it('makes sure socket.io.js actually exists', function (done) {
|
|
fs.stat(lib.getPathToClientSource(), done)
|
|
})
|
|
})
|
|
|
|
context('.getClientVersion', function () {
|
|
it('returns client version', function () {
|
|
expect(lib.getClientVersion()).to.eq(pkg.dependencies['socket.io-client'])
|
|
})
|
|
})
|
|
|
|
context('.getClientSource', function () {
|
|
it('returns client source as a string', function (done) {
|
|
const clientPath = path.join(process.cwd(), 'node_modules', 'socket.io-client', 'dist', 'socket.io.js')
|
|
|
|
fs.readFile(clientPath, 'utf8', function (err, str) {
|
|
if (err) done(err)
|
|
|
|
expect(lib.getClientSource()).to.eq(str)
|
|
done()
|
|
})
|
|
})
|
|
})
|
|
})
|