File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed
Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+ set -o pipefail
4+
5+ mkdir -p ./tmp
6+ npm pack
7+ mv * .tgz ./tmp
8+ tar xvzf tmp/* .tgz -C ./tmp
9+
10+ exit 0
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+ set -o pipefail
4+
5+ echo ' Testing Package for publishing...'
6+ ./node_modules/.bin/tape ./test/publish.js
7+
8+ echo ' Attempting npm publish...'
9+ npm publish
10+
11+ echo ' Success'
12+
13+ exit 0
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ var test = require ( 'tape' ) ;
4+ var exec = require ( 'child_process' ) . exec ;
5+
6+ function cleanUp ( cb ) {
7+ return exec ( 'rm -rf ./tmp' , cb ) ;
8+ }
9+
10+ function makeTestPackage ( cb ) {
11+ return exec ( './scripts/mockPublish' , cb ) ;
12+ }
13+
14+ // with regards to averting npm publishing disasters https://github.com/floridoo/gulp-sourcemaps/issues/246
15+ test ( 'can load a published version' , function ( t ) {
16+ // return t.fail("mock fail");
17+ cleanUp ( function ( ) {
18+ makeTestPackage ( function ( ) {
19+ try {
20+ // attempt to load a packed / unpacked potential deployed version
21+ require ( '../tmp/package/index' ) ;
22+ }
23+ catch ( error ) {
24+ t . fail ( error ) ;
25+ }
26+ finally {
27+ cleanUp ( function ( ) {
28+ t . end ( ) ;
29+ } ) ;
30+ }
31+ } ) ;
32+ } ) ;
33+ } ) ;
You can’t perform that action at this time.
0 commit comments