문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판이전 판다음 판 | 이전 판 | ||
| study:script_test [2019/07/06 08:44] – [Script Test] taekgu | study:script_test [2025/04/15 10:05] (현재) – 바깥 편집 127.0.0.1 | ||
|---|---|---|---|
| 줄 18: | 줄 18: | ||
| npm install --save-dev karma-jasmine karma-jasmine-html-reporter karma-mocha-reporter karma-webpack | npm install --save-dev karma-jasmine karma-jasmine-html-reporter karma-mocha-reporter karma-webpack | ||
| </ | </ | ||
| + | |||
| + | // 여기는 Tama가 추가 // | ||
| + | | ||
| + | npm install --save-dev @types/ | ||
| + | ** 기타 로더들 ** | ||
| + | * babel-loader | ||
| + | * css-loader | ||
| + | * style-loader | ||
| + | * ts-loader | ||
| + | |||
| ==== 2.karma.conf.js파일 생성 ==== | ==== 2.karma.conf.js파일 생성 ==== | ||
| '' | '' | ||
| 줄 238: | 줄 248: | ||
| + | ==== mamajs의 karma.conf.js ==== | ||
| + | <code javascript karma.conf.js> | ||
| + | // Karma configuration | ||
| + | // Generated on Mon Jun 03 2019 23:19:22 GMT+0900 (대한민국 표준시) | ||
| + | const path = require(' | ||
| + | var webpackConfig = require(' | ||
| + | |||
| + | module.exports = function(config) { | ||
| + | config.set({ | ||
| + | |||
| + | // base path that will be used to resolve all patterns (eg. files, exclude) | ||
| + | basePath: '', | ||
| + | |||
| + | |||
| + | // frameworks to use | ||
| + | // available frameworks: https:// | ||
| + | frameworks: [' | ||
| + | |||
| + | // list of files / patterns to load in the browser | ||
| + | files: [ | ||
| + | {pattern: ' | ||
| + | {pattern: ' | ||
| + | {pattern: ' | ||
| + | / | ||
| + | watched: if autoWatch is true all files that have watched set to true will be watched for changes | ||
| + | served: should the files be served by Karma' | ||
| + | included: should the files be included in the browser using < | ||
| + | nocache: should the files be served from disk on each request by Karma' | ||
| + | /*assets: | ||
| + | {pattern: ' | ||
| + | {pattern: ' | ||
| + | ], | ||
| + | |||
| + | // list of files / patterns to exclude | ||
| + | exclude: [ ], | ||
| + | |||
| + | // start these browsers | ||
| + | // available browser launchers: https:// | ||
| + | browsers: [' | ||
| + | |||
| + | // enable / disable watching file and executing tests whenever any file changes | ||
| + | autoWatch: true, | ||
| + | |||
| + | client: { | ||
| + | //capture all console output and pipe it to the terminal, true is default | ||
| + | captureConsole: | ||
| + | //if true, Karma clears the context window upon the completion of running the tests, true is default | ||
| + | clearContext: | ||
| + | //run the tests on the same window as the client, without using iframe or a new window, false is default | ||
| + | runInParent: | ||
| + | //true: runs the tests inside an iFrame; false: runs the tests in a new window, true is default | ||
| + | useIframe: | ||
| + | jasmine:{ | ||
| + | //tells jasmine to run specs in semi random order, false is default | ||
| + | random: false | ||
| + | } | ||
| + | }, | ||
| + | // 여기부터 기본 init에서 수정 사항 | ||
| + | // 웹팩 설정 가져오기?? | ||
| + | webpack: { | ||
| + | mode: ' | ||
| + | //module: webpackConfig.module, | ||
| + | resolve: webpackConfig.resolve, | ||
| + | module: { | ||
| + | rules: [ | ||
| + | { | ||
| + | test: /\.jsx$/i, | ||
| + | include: [ | ||
| + | path.resolve(__dirname, | ||
| + | ], | ||
| + | exclude: [/ | ||
| + | use: { | ||
| + | loader: ' | ||
| + | options: { | ||
| + | presets: [' | ||
| + | // plugins: [' | ||
| + | } | ||
| + | } | ||
| + | }, | ||
| + | { | ||
| + | test: /\.tsx?$/i, | ||
| + | include: [ | ||
| + | path.resolve(__dirname, | ||
| + | ], | ||
| + | exclude: [/ | ||
| + | use: { | ||
| + | loader: ' | ||
| + | } | ||
| + | }, | ||
| + | { | ||
| + | test: /\.css$/i, | ||
| + | use: [' | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | }, | ||
| + | |||
| + | // preprocess matching files before serving them to the browser | ||
| + | // available preprocessors: | ||
| + | preprocessors: | ||
| + | ' | ||
| + | ' | ||
| + | }, | ||
| + | |||
| + | // test results reporter to use | ||
| + | // possible values: ' | ||
| + | // available reporters: https:// | ||
| + | reporters: [' | ||
| + | |||
| + | |||
| + | // web server port | ||
| + | port: 9876, | ||
| + | |||
| + | |||
| + | // enable / disable colors in the output (reporters and logs) | ||
| + | colors: true, | ||
| + | |||
| + | |||
| + | // level of logging | ||
| + | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
| + | //logLevel: config.LOG_INFO, | ||
| + | logLevel: config.LOG_ERROR, | ||
| + | |||
| + | // Continuous Integration mode | ||
| + | // if true, Karma captures browsers, runs the tests and exits | ||
| + | singleRun: false, | ||
| + | |||
| + | // Concurrency level | ||
| + | // how many browser should be started simultaneous | ||
| + | concurrency: | ||
| + | }) | ||
| + | } | ||
| + | </ | ||
| ===== Jasmine ===== | ===== Jasmine ===== | ||
| ** Behavior-Driven JavaScript ** | ** Behavior-Driven JavaScript ** | ||