File tree Expand file tree Collapse file tree 12 files changed +160
-18
lines changed Expand file tree Collapse file tree 12 files changed +160
-18
lines changed Original file line number Diff line number Diff line change @@ -11,5 +11,5 @@ package-lock.json
11
11
12
12
* .d.ts
13
13
* .js
14
- ! jest.config .js
14
+ ! karma.conf .js
15
15
* .js.map
Original file line number Diff line number Diff line change
1
+ /// <reference types="jest" />
1
2
import { S3 } from "./S3" ;
2
3
import { SerializeMiddleware } from "@aws-sdk/types" ;
3
4
import { HttpRequest } from "@aws-sdk/protocol-http" ;
Original file line number Diff line number Diff line change
1
+ /// <reference types="mocha" />
2
+ /**
3
+ * This is the integration test that make sure the client can make request cross-platform-ly
4
+ * in NodeJS, Chromium and Firefox. This test is written in mocha.
5
+ */
6
+ import { expect } from "chai" ;
7
+ import { S3Client , PutObjectCommand , DeleteObjectCommand } from "../index" ;
8
+ declare let defaultRegion : string ;
9
+ declare const credentials : any ;
10
+ declare const isBrowser : boolean ; //undefined by default, used for NodeJS.
11
+
12
+ const Bucket = "aws-sdk-unit-test" ; // this bucket requires enabling CORS
13
+ const Key = `${ Date . now ( ) } ` ;
14
+
15
+ describe ( "@aws-sdk/client-s3" , ( ) => {
16
+ const client = new S3Client ( {
17
+ region : defaultRegion ,
18
+ credentials
19
+ } ) ;
20
+
21
+ after ( async ( ) => {
22
+ await client . send (
23
+ new DeleteObjectCommand ( {
24
+ Bucket,
25
+ Key
26
+ } )
27
+ ) ;
28
+ } ) ;
29
+
30
+ if ( isBrowser ) {
31
+ it ( "PutObject should succeed when given blob body" , async ( ) => {
32
+ const smallBody = [ ] ;
33
+ const result = await client . send (
34
+ new PutObjectCommand ( {
35
+ Bucket,
36
+ Key,
37
+ Body : new Blob ( [ "abc" ] )
38
+ } )
39
+ ) ;
40
+ expect ( result . $metadata . httpStatusCode ) . to . eql ( 200 ) ;
41
+ } ) ;
42
+ }
43
+ } ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ module . exports = function ( config ) {
2
+ config . set ( {
3
+ basePath : "" ,
4
+ frameworks : [ "mocha" , "chai" ] ,
5
+ files : [ "e2e/**/*.ispec.ts" ] ,
6
+ preprocessors : {
7
+ "e2e/**/*.ispec.ts" : [ "webpack" , "sourcemap" , "credentials" ]
8
+ } ,
9
+ webpackMiddleware : {
10
+ stats : "minimal"
11
+ } ,
12
+ webpack : {
13
+ resolve : {
14
+ extensions : [ ".ts" , ".js" ]
15
+ } ,
16
+ mode : "development" ,
17
+ module : {
18
+ rules : [
19
+ {
20
+ test : / \. t s x ? $ / ,
21
+ use : [
22
+ {
23
+ loader : "ts-loader" ,
24
+ options : {
25
+ configFile : "tsconfig.e2e.json" ,
26
+ compilerOptions : {
27
+ rootDir : "./"
28
+ }
29
+ }
30
+ }
31
+ ] ,
32
+ exclude : / n o d e _ m o d u l e s /
33
+ }
34
+ ]
35
+ } ,
36
+ // stats: {
37
+ // // colors: false,
38
+ // // modules: false,
39
+ // // reasons: false,
40
+ // // assets: false,
41
+ // // moduleAssets: false,
42
+ // // chunks: false,
43
+ // // errorDetails: true
44
+ // all: false
45
+ // },
46
+ devtool : "inline-source-map"
47
+ } ,
48
+ plugins : [
49
+ "@aws-sdk/karma-credential-loader" ,
50
+ "karma-chrome-launcher" ,
51
+ "karma-firefox-launcher" ,
52
+ "karma-mocha" ,
53
+ "karma-chai" ,
54
+ "karma-webpack" ,
55
+ "karma-coverage" ,
56
+ "karma-sourcemap-loader"
57
+ ] ,
58
+ port : 9876 ,
59
+ colors : true ,
60
+ logLevel : config . LOG_WARN ,
61
+ autoWatch : false ,
62
+ browsers : [ "ChromeHeadless" , "FirefoxHeadless" ] ,
63
+ customLaunchers : {
64
+ FirefoxHeadless : {
65
+ base : "Firefox" ,
66
+ flags : [ "-headless" ]
67
+ }
68
+ } ,
69
+ singleRun : true ,
70
+ concurrency : Infinity ,
71
+ exclude : [ "**/*.d.ts" , "*.spec.ts" ]
72
+ } ) ;
73
+ } ;
Original file line number Diff line number Diff line change 12
12
"remove-documentation" : " rimraf ./docs" ,
13
13
"remove-js" : " rimraf *.js && rimraf ./commands/*.js && rimraf ./models/*.js && rimraf ./protocols/*.js" ,
14
14
"remove-maps" : " rimraf *.js.map && rimraf ./commands/*.js.map && rimraf ./models/*.js.map && rimraf ./protocols/*.js.map" ,
15
- "test" : " jest --passWithNoTests " ,
15
+ "test:browser " : " karma start karma.conf.js " ,
16
16
"build:es" : " tsc -p tsconfig.es.json" ,
17
17
"build" : " yarn pretest && yarn build:es"
18
18
},
39
39
"@aws-sdk/hash-node" : " 1.0.0-gamma.1" ,
40
40
"@aws-sdk/hash-stream-node" : " 1.0.0-gamma.1" ,
41
41
"@aws-sdk/invalid-dependency" : " 1.0.0-gamma.1" ,
42
+ "@aws-sdk/karma-credential-loader" : " 1.0.0-gamma.0" ,
42
43
"@aws-sdk/md5-js" : " 1.0.0-gamma.1" ,
43
44
"@aws-sdk/middleware-apply-body-checksum" : " 1.0.0-gamma.1" ,
44
45
"@aws-sdk/middleware-bucket-endpoint" : " 1.0.0-gamma.1" ,
74
75
"tslib" : " ^1.8.0"
75
76
},
76
77
"devDependencies" : {
78
+ "@types/chai" : " ^4.2.11" ,
79
+ "@types/mocha" : " ^7.0.2" ,
77
80
"@types/node" : " ^12.7.5" ,
78
- "jest" : " ^25.1.0" ,
79
81
"rimraf" : " ^3.0.0" ,
80
82
"tslib" : " ^1.8.0" ,
81
83
"typedoc" : " ^0.15.0" ,
Original file line number Diff line number Diff line change
1
+ {
2
+ "extends" : " ./tsconfig.json" ,
3
+ "compilerOptions" : {
4
+ "rootDir" : " .." ,
5
+ "target" : " es5" ,
6
+ "lib" : [" dom" ],
7
+ "types" : [" mocha" ]
8
+ },
9
+ "exclude" : [" ./*.spec.ts" , " dist" , " types" ]
10
+ }
Original file line number Diff line number Diff line change 12
12
"incremental" : true ,
13
13
"resolveJsonModule" : true ,
14
14
"declarationDir" : " ./types" ,
15
- "outDir" : " dist/cjs"
15
+ "outDir" : " dist/cjs" ,
16
+ "types" : [" jest" ]
16
17
},
17
18
"typedocOptions" : {
18
19
"exclude" : " **/node_modules/**" ,
23
24
"mode" : " file" ,
24
25
"out" : " ./docs" ,
25
26
"plugin" : " @aws-sdk/client-documentation-generator"
26
- }
27
+ },
28
+ "exclude" : [" e2e" , " types" ]
27
29
}
Original file line number Diff line number Diff line change 40
40
"@commitlint/config-conventional" : " ^8.3.4" ,
41
41
"@types/fs-extra" : " ^8.0.1" ,
42
42
"@types/jest" : " ^25.1.4" ,
43
+ "chai" : " ^4.2.0" ,
43
44
"codecov" : " ^3.4.0" ,
44
45
"cucumber" : " ^6.0.5" ,
45
46
"fs-extra" : " ^9.0.0" ,
49
50
"jest" : " ^25.1.0" ,
50
51
"jmespath" : " ^0.15.0" ,
51
52
"karma" : " ^5.1.0" ,
53
+ "karma-chai" : " ^0.1.0" ,
52
54
"karma-chrome-launcher" : " ^3.1.0" ,
53
55
"karma-coverage" : " ^2.0.2" ,
56
+ "karma-firefox-launcher" : " ^1.3.0" ,
54
57
"karma-jasmine" : " ^3.3.1" ,
58
+ "karma-mocha" : " ^2.0.1" ,
59
+ "karma-sourcemap-loader" : " ^0.3.7" ,
55
60
"karma-typescript" : " ^5.0.3" ,
61
+ "karma-webpack" : " ^4.0.2" ,
56
62
"lerna" : " 3.22.1" ,
57
63
"lint-staged" : " ^10.0.1" ,
64
+ "mocha" : " ^8.0.1" ,
58
65
"prettier" : " 2.0.5" ,
59
66
"puppeteer" : " ^4.0.0" ,
67
+ "ts-loader" : " ^7.0.5" ,
60
68
"typescript" : " ~3.8.3" ,
69
+ "webpack" : " ^4.43.0" ,
70
+ "webpack-cli" : " ^3.3.12" ,
61
71
"yarn" : " 1.22.4"
62
72
},
63
73
"workspaces" : {
Original file line number Diff line number Diff line change
1
+ # Smoke Tests
2
+
3
+ Smoke tests is used to make sure the SDK can make API request correctly to the AWS backend. It does not intended to
4
+ integration tests for more abstract interfaces or utilities.
Original file line number Diff line number Diff line change 1720
1720
dependencies :
1721
1721
" @babel/types" " ^7.3.0"
1722
1722
1723
+ " @types/chai@^4.2.11 " :
1724
+ version "4.2.11"
1725
+ resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.2.11.tgz#d3614d6c5f500142358e6ed24e1bf16657536c50"
1726
+ integrity sha512-t7uW6eFafjO+qJ3BIV2gGUyZs27egcNRkUdalkud+Qa3+kg//f129iuOFivHDXQ+vnU3fDXuwgv0cqMCbcE8sw==
1727
+
1723
1728
" @types/color-name@^1.1.1 " :
1724
1729
version "1.1.1"
1725
1730
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
1821
1826
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.0.tgz#69a23a3ad29caf0097f06eda59b361ee2f0639f6"
1822
1827
integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY=
1823
1828
1829
+ " @types/mocha@^7.0.2 " :
1830
+ version "7.0.2"
1831
+ resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-7.0.2.tgz#b17f16cf933597e10d6d78eae3251e692ce8b0ce"
1832
+ integrity sha512-ZvO2tAcjmMi8V/5Z3JsyofMe3hasRcaw88cto5etSVMwVQfeivGAlEYmaQgceUSVYFofVjT+ioHsATjdWcFt1w==
1833
+
1824
1834
" @types/node@*" , "@types/node@>= 8":
1825
1835
version "14.0.13"
1826
1836
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.13.tgz#ee1128e881b874c371374c1f72201893616417c9"
You can’t perform that action at this time.
0 commit comments