forked from enviPath/enviPy
Current Dev State
This commit is contained in:
26
static/js/ketcher2/node_modules/gulp-tap/tests/base.test.coffee
generated
vendored
Normal file
26
static/js/ketcher2/node_modules/gulp-tap/tests/base.test.coffee
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
gulp = require 'gulp'
|
||||
tap = require '../'
|
||||
tapTest = require 'tap'
|
||||
|
||||
|
||||
# helper function to get a path relative to the root
|
||||
getPath = (rel) -> path.resolve __dirname, '..', rel
|
||||
|
||||
|
||||
tapTest.test "change file.base twice will end with 'Error: no writecb in Transform classh' #5", (test) ->
|
||||
|
||||
test.plan 1
|
||||
|
||||
fixturePath = getPath 'tests/fixtures/'
|
||||
|
||||
gulp.src fixturePath + '/js.js'
|
||||
.pipe tap (file) ->
|
||||
file.old_base = file.base
|
||||
file.base += 'random-path/'
|
||||
.pipe tap (file) ->
|
||||
file.base = file.old_base
|
||||
.pipe tap (file) ->
|
||||
test.ok true
|
||||
test.end()
|
||||
84
static/js/ketcher2/node_modules/gulp-tap/tests/dest.test.coffee
generated
vendored
Normal file
84
static/js/ketcher2/node_modules/gulp-tap/tests/dest.test.coffee
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
gulp = require 'gulp'
|
||||
tap = require '../'
|
||||
tapTest = require 'tap'
|
||||
|
||||
deleteDirectory = (p) ->
|
||||
if fs.existsSync p
|
||||
fs.readdirSync(p).forEach (file) ->
|
||||
curP = (p + '/' + file)
|
||||
if fs.lstatSync(curP).isDirectory()
|
||||
deleteDirectory curP
|
||||
else
|
||||
fs.unlinkSync curP
|
||||
fs.rmdirSync p
|
||||
|
||||
clean = ->
|
||||
deleteDirectory 'assets'
|
||||
deleteDirectory 'scripts'
|
||||
deleteDirectory 'sass'
|
||||
|
||||
# helper function to get a path relative to the root
|
||||
getPath = (rel) -> path.resolve __dirname, '..', rel
|
||||
|
||||
|
||||
tapTest.test "gulp-tap can change dest in the middle of stream", (test) ->
|
||||
|
||||
test.tearDown(clean)
|
||||
|
||||
test.plan 3
|
||||
|
||||
destinations =
|
||||
'scss': 'sass'
|
||||
'js': 'scripts'
|
||||
'img': 'assets/images'
|
||||
|
||||
fixturePath = getPath 'tests/fixtures/'
|
||||
|
||||
where = (file, t) ->
|
||||
match = (p) ->
|
||||
ext = (path.extname p)
|
||||
.substr 1 # remove leading '.'
|
||||
if( ext in ['jpg', 'png', 'svg', 'gif'] )
|
||||
ext = 'img'
|
||||
destinations[ext] or false
|
||||
|
||||
# for debugging
|
||||
# console.log 'destPath', destPath, file.path
|
||||
destPath = match file.path
|
||||
|
||||
if destPath
|
||||
t.through gulp.dest, [destPath]
|
||||
|
||||
|
||||
fs.readdir fixturePath, (err, files) ->
|
||||
if err
|
||||
console.trace('Can not read fixtures from ' + fixturePath)
|
||||
test.end()
|
||||
|
||||
gulp.src files.map (p) -> (fixturePath + '/' + p)
|
||||
.pipe tap where
|
||||
.on 'end', ->
|
||||
setTimeout (->
|
||||
test.ok fs.existsSync getPath 'assets/images/img.png'
|
||||
test.ok fs.existsSync getPath 'scripts/js.js'
|
||||
test.ok fs.existsSync getPath 'sass/s.scss'
|
||||
test.end()
|
||||
), 500 # give gulp.dest a (500ms) chance to write the files
|
||||
.on 'error', (err) ->
|
||||
console.trace(err)
|
||||
test.end()
|
||||
.pipe tap(->) # We must provide a pipe to make stream end
|
||||
|
||||
|
||||
### stub for https://github.com/geejs/gulp-tap/issues/3
|
||||
exports.sameIOFileName =
|
||||
|
||||
'test for infinite loop, issue #3': (test) ->
|
||||
test.plan 1
|
||||
|
||||
fixturePath = getPath 'tests/fixtures/'
|
||||
gulp.src fixturePath + '/*'
|
||||
test.ok true
|
||||
test.end()###
|
||||
1
static/js/ketcher2/node_modules/gulp-tap/tests/fixtures/img.png
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/gulp-tap/tests/fixtures/img.png
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
I'm an image file
|
||||
1
static/js/ketcher2/node_modules/gulp-tap/tests/fixtures/js.js
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/gulp-tap/tests/fixtures/js.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
I'm a javascript file
|
||||
1
static/js/ketcher2/node_modules/gulp-tap/tests/fixtures/s.scss
generated
vendored
Normal file
1
static/js/ketcher2/node_modules/gulp-tap/tests/fixtures/s.scss
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
I'm a SASS file
|
||||
35
static/js/ketcher2/node_modules/gulp-tap/tests/throws.test.coffee
generated
vendored
Normal file
35
static/js/ketcher2/node_modules/gulp-tap/tests/throws.test.coffee
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
process.env['NODE_ENV'] = 'development'
|
||||
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
gulp = require 'gulp'
|
||||
tap = require '../'
|
||||
tapTest = require 'tap'
|
||||
|
||||
|
||||
# helper function to get a path relative to the root
|
||||
getPath = (rel) -> path.resolve __dirname, '..', rel
|
||||
|
||||
identity = (x) -> x
|
||||
|
||||
|
||||
tapTest.test "throw errors", (test) ->
|
||||
|
||||
test.plan 2
|
||||
|
||||
gulp.src getPath 'tests/fixtures/' + 'js.js'
|
||||
.pipe tap (file, t) ->
|
||||
test.throws t.through.bind(null, gulp.dest, "wrong"), new TypeError("Args must be an array to `apply` to the filter")
|
||||
|
||||
gulp.src getPath 'tests/fixtures/' + 'js.js'
|
||||
.pipe tap (file, t) ->
|
||||
test.throws t.through.bind(null, identity, ["right"]), {}, "should throw if supplied function doesn't return a stream'"
|
||||
|
||||
### Giving up due to lack of knowledge about vinyl-fs streams - I don't know how to get them to emit an error
|
||||
tapTest.test "emit errors from stream errors", (test) ->
|
||||
|
||||
test.plan 1
|
||||
|
||||
gulp.src getPath 'tests/fixtures/' + 'js.js'
|
||||
.pipe tap (file, t) ->
|
||||
test.doesNotThrow t.through.bind(null, gulp.src, ['non-existing.txt'])###
|
||||
Reference in New Issue
Block a user